SSM框架整合

所需配置文件

application-dao.xml
application-service.xml
application-trans.xml
db.properties
log4j.properties
springMvc.xml
SqlMapConfig.xml
web.xml

application-dao.xml

//载入配置文件


//配置连接池

   
  
  
  


//给SqlSessionFactoryBean注入连接池和 SqlMapConfig.xml,spring和mybatis整合

  
   


//自动扫描该包下的mapper.xml文件

   


application-service.xml

//自动扫描包下的service

application-trans.xml

//给事务管理注入数据源

  


//配置我们的事务管理
  
  
      
    
    
    
    
    
  


//给我们的事务管理加到方法上去

   

db.properties

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssm
jdbc.username=root
jdbc.password=1234

log4j.properties

# Global logging configuration
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

springMvc.xml

//自动载入controller


//自动载入handler和adapter等等


//配置view解析
  
  //配置前缀和后缀
  
  


//自动释放静态资源

SqlMapConfig.xml

 

  //给包里的类起别名
  
    
    
  

  

web.xml

//配置dispatcherservlet

  DispatcherServlet
  org.springframework.web.servlet.DispatcherServlet
  //配置初始化参数
  
    contextConfigLocation
    classpath:springMvc.xml
  


//将dispatcher映射

  DispatcherServlet
  /


//在服务器启动时自动加载配置文件

  org.springframework.web.context.ContextLoaderListener


//将配置文件配在Context中

  contextConfigLocation
  classpath:application-*.xml  
      
//配置字符集过滤器

  EncodingFilter
  org.springframework.web.filter.CharacterEncodingFilter
  
    encoding         
    UTF-8    
  



  EncodingFilter 
  /*

你可能感兴趣的:(SSM框架整合)