SpringMVC+Spring Security+mave+mybatis整合一

1.pom.xml
http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0modelVersion>
	<groupId>smmgroupId>
	<artifactId>smmartifactId>
	<packaging>warpackaging>
	<version>0.0.1-SNAPSHOTversion>
	<name>smm Maven Webappname>
	<url>http://maven.apache.orgurl>
	<dependencies>
		
		<dependency>
			<groupId>org.springframeworkgroupId>
			<artifactId>spring-testartifactId>
			<version>4.0.5.RELEASEversion>
		dependency>
		<dependency>
			<groupId>org.springframeworkgroupId>
			<artifactId>spring-webmvcartifactId>
			<version>4.0.5.RELEASEversion>
		dependency>
		<dependency>
			<groupId>org.springframeworkgroupId>
			<artifactId>spring-coreartifactId>
			<version>4.0.5.RELEASEversion>
		dependency>
		<dependency>
			<groupId>org.springframeworkgroupId>
			<artifactId>spring-txartifactId>
			<version>4.0.5.RELEASEversion>
		dependency>
		<dependency>
			<groupId>org.springframeworkgroupId>
			<artifactId>spring-jdbcartifactId>
			<version>4.0.5.RELEASEversion>
		dependency>
		

		
		
			org.mybatis
			mybatis
			3.2.7
		
		
			org.mybatis
			mybatis-spring
			1.2.2
		
		


		
			mysql
			mysql-connector-java
			5.1.31
		

		
		
		

		
		
			junit
			junit
			4.11
		
		

		
		
			com.alibaba
			druid
			1.0.6
		
		

		
		
			org.aspectj
			aspectjweaver
			1.8.1
		
		

		
		
			org.codehaus.jackson
			jackson-mapper-asl
			1.9.13
		
		

		
		
			commons-fileupload
			commons-fileupload
			1.3.1
		
		

		
		
			javax.servlet
			servlet-api
			3.0-alpha-1
			provided
		
		

		
		
			log4j
			log4j
			1.2.17
		
		

		
		
			com.alibaba
			fastjson
			1.1.41
		
		
		
			jstl
			jstl
			1.2
		

		
			javax.servlet.jsp
			jsp-api
			2.1
			provided
		

		

		
		
			org.springframework.security
			spring-security-taglibs
			4.0.4.RELEASE
		
	
		
			org.springframework.security
			spring-security-config
			4.0.4.RELEASE
		
		
			 
	
	
	
		smm
		src/test
		
			
				
				
					org.apache.tomcat.maven
					tomcat6-maven-plugin
					2.2
					
						8080
						/
						true
					
				
				

				
				
					org.apache.tomcat.maven
					tomcat7-maven-plugin
					2.2
					
						9090
						/
						true
						UTF-8
					
				
				
			
		
		
			
				org.apache.maven.plugins
				maven-compiler-plugin
				3.0
				
					1.6
					1.6
				
			
			
			
				org.mortbay.jetty
				jetty-maven-plugin
				
					10
					
						/smm
					
					
						
							8888
							60000
						
					
				
			
			
		
	
project>
2.web.xml

http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>smmdisplay-name>

    
    
        contextConfigLocation
        
        	classpath:spring.xml;classpath:spring-mybatis.xml;classpath:applicationContext*.xml
        
    
    
    
        webAppRootKey
        springmvc.root
    
    
    
    
        SpringEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
        
            forceEncoding
            true
        
    
    
        SpringEncodingFilter
        /*
    
	
	
	
        springSecurityFilterChain
        org.springframework.web.filter.DelegatingFilterProxy
    
    
        springSecurityFilterChain
        /*
    
    
 
    
    
        
        log4jConfigLocation
        classpath:log4j.properties
    
    
        
        log4jRefreshInterval
        6000
    
    
        org.springframework.web.util.Log4jConfigListener
    

    
        org.springframework.web.context.ContextLoaderListener
    
    
    
        org.springframework.web.util.IntrospectorCleanupListener
    
 
    
    
        spring
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:spring-mvc.xml
        
        1
    
    
        spring
        /**
    
    
    	15
    
 
    
        index.jsp
    
 
    
    
        
        404
        /WEB-INF/errorpage/404.jsp
    
    
        
        405
        /WEB-INF/errorpage/405.jsp
    
    
        
        500
        /WEB-INF/errorpage/500.jsp
    
web-app>
3.spring.xml

http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
">

	
	

	
	 
beans>

4.spring-mybatis.xml

http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
">
	
	

	
	
		
		
		

		
		
		
		
		
		
		
		
		
		

		

		
		
		
		

		
		
		
		

		
		
		
		
		
		

		
		
		
	

	
	
		
		
		
	

	
		
		
	

	
	
		
	

	
	

	
	
		
			
			
			
			
			
			
			
			
			
			
			

			
			
			
			
			

			
		
	
	
		
		
	


	
	
	
	
		
			
				com.smm.service.*
			
		
	
	
		
	

beans>
5.spring-mvc.xml

http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-4.0.xsd 
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">

	
	
	
	
	
	
	
	
	
		
			
				text/html;charset=UTF-8
			
		
	

	
	
		
			
				
			
		
	

	
	

	
		
			UTF-8
		
		
			32505856
		
		
			4096
		
	

beans>
6.log4j.properties
log4j.rootLogger=DEBUG,Console,File

log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.Target=System.out
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%c]%m%n
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

log4j.rootLogger=INFO, A1 
log4j.appender.A1=org.apache.log4j.ConsoleAppender 
log4j.appender.A1.layout=org.apache.log4j.PatternLayout 
log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n

log4j.appender.File=org.apache.log4j.RollingFileAppender 
log4j.appender.File.File=cfe.samsung.log
log4j.appender.File.MaxFileSize=10MB
log4j.appender.File.Threshold=ALL
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=[%p][%d{yyyy-MM-dd HH\:mm\:ss,SSS}][%c]%m%n

log4j.logger.org.springframework=DEBUG,A1
log4j.logger.org.springframework.web.context.support=info,A1
log4j.logger.org.springframework.jdbc.core=debug,A1
log4j.logger.java.sql=info,A1
log4j.logger.com.huahai=DEBUG,A1
log4j.logger.org.apache.ibatis=DEBUG,A1

7.config.properties
#hibernate.dialect=org.hibernate.dialect.OracleDialect
#driverClassName=oracle.jdbc.driver.OracleDriver
#validationQuery=SELECT 1 FROM DUAL
#jdbc_url=jdbc:oracle:thin:@localhost:1521:orcl
#jdbc_username=scott
#jdbc_password=tiger

#hibernate.dialect=org.hibernate.dialect.MySQLDialect
#driverClassName=com.mysql.jdbc.Driver
validationQuery=SELECT 1
jdbc_url=jdbc:mysql://localhost:3306/cfe?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
jdbc_username=root
jdbc_password=root

#hibernate.dialect=org.hibernate.dialect.SQLServerDialect
#driverClassName=net.sourceforge.jtds.jdbc.Driver
#validationQuery=SELECT 1
#jdbc_url=jdbc:jtds:sqlserver://127.0.0.1:1433/sy
#jdbc_username=sa
#jdbc_password=123456

#hibernate.dialect=org.hibernate.dialect.DerbyDialect
#driverClassName=org.apache.derby.jdbc.EmbeddedDriver
#validationQuery=SELECT 1
#jdbc_url=jdbc:derby:sy;create=true
#jdbc_username=sypro
#jdbc_password=sypro

#jndiName=java:comp/env/dataSourceName

hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
hibernate.format_sql=true

sessionInfoName=sessionInfo

uploadFieldName=filedata
uploadFileMaxSize=20971520
uploadFileExts=txt,rar,zip,doc,docx,xls,xlsx,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid
uploadDirectory=attached

8.applicationContext.xml



    
        
        
        
        
          
        
    

    
        
            
                
                
            
        
    

 

你可能感兴趣的:(技术)