Spring集成MyBatis框架(环境详细配置)

目录

配置pom.xml配置文件

配置spring.xml

配置Mybatis.xml

配置log4j.properties


配置pom.xml配置文件




  4.0.0

  org.example
  spring_mybatis
  1.0-SNAPSHOT

  spring_mybatis
  
  http://www.example.com

  
    UTF-8
    1.8
    1.8
  

  
    
    
      junit
      junit
      4.12
      test
    

    
    
      org.springframework
      spring-context
      4.3.16.RELEASE
    

    
    
      org.springframework
      spring-test
      4.2.4.RELEASE
    

    
    
      org.springframework
      spring-jdbc
      4.2.4.RELEASE
    

    
    
      org.springframework
      spring-tx
      4.2.4.RELEASE
    

    
    
      org.aspectj
      aspectjweaver
      1.8.7
    

    
    
      com.mchange
      c3p0
      0.9.5.5
    

    
    
      org.mybatis
      mybatis
      3.2.8
    

    
    
      org.mybatis
      mybatis-spring
      1.2.2
    

    
    
      mysql
      mysql-connector-java
      5.1.32
    

    
    
      org.slf4j
      slf4j-log4j12
      1.6.1
    

  

  
  
    
      
        src/main/properties
      
      
        src/main/java
        
          **/*.xml
          **/*.properties
          **/*.tld
        
        false
      

    
  



配置spring.xml





    
    

    
    

    
    

    
    
        
        
        
        
    

    
    
        
    

    
    
        
            
            

        
    

    
    
        
        
    

    
    
        
        
        
    

    
    
        
        
    

配置Mybatis.xml




    
    
        jdbc.driver = com.mysql.cj.jdbc.Driver
jdbc.url = jdbc :mysql://localhost:3306/spring._mybatis?useUnicode = true&characterEncoding=utf&serverTimezone=GMT%2B88useSSL=false
jdbc.username = root
jdbc.password = root
#localhost:3306/spring._mybatis
#localhost 用户名
#3306 MySQL接口
#spring._mybatis 数据库名称 不同需要更改

配置log4j.properties

1og4j.rootlogger =DEBUG, Console
# Console  日志
log4j.appender.Console = org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout = org.apache.1og4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern = xd [%t] %-5p [%c] - %m%n
log41.logger.java.sql.ResultSet=INFO
log4j.logger.org.apache=INFO
log4j.logger.java.sql.Connection=DEBUG
log41.logger.java.sql.Statement=DEBUG
log4j.logger.java.sq1.PreparedStatement=DEBUG

你可能感兴趣的:(Java,框架,mybatis,spring,java)