Maven+Spring+SpringMVC+MyBatis整合

整合思路

web.xml指定spingmvc.xml和applicationContext.xml

applicationContext.xml指定mybatis.xml

 

一、创建Maven工程

二、编写web.xml文件



	
 	
	
		springDispatcherServlet
		org.springframework.web.servlet.DispatcherServlet
		
			contextConfigLocation
			classpath:springmvc.xml
		
		1
	
	
		springDispatcherServlet
		/
	
	
	
	
		contextConfigLocation
		classpath:applicationContext.xml
	

	
		org.springframework.web.context.ContextLoaderListener
	
	
	
	
	
		编码过滤器
		encodingFilter
		org.springframework.web.filter.CharacterEncodingFilter
		
			encoding
			UTF-8
		
		
			forceEncoding
			true
		
	
	
		encodingFilter
		/*
	
		
	

  Archetype Created Web Application

三、编写springmvc.xml文件



	
	
	
	
	
	
	
	
	
		
		
	


四、编写applicationContext.xml文件




	
	

	
	
		
		
		
		
	
	
	
	
		
		
		
	
	
	
	
		
	


五、编写mybatis.xml文件




	
		
		
		
		
	

	
	
		
	

六、pom.xml


	4.0.0
	com.yf
	ssm01
	0.0.1-SNAPSHOT
	war
	
		5.1.5.RELEASE
		
		1.8
        1.8
	

	

		
		
		
			org.mybatis
			mybatis
			3.4.6
		
		
		
			org.mybatis
			mybatis-spring
			2.0.1
		
		
		
			org.springframework
			spring-context
			${spring.version}
			
		
		
			org.springframework
			spring-core
			${spring.version}
		
		
			org.springframework
			spring-beans
			${spring.version}
		
		
			org.springframework
			spring-aop
			${spring.version}
		
		
			org.springframework
			spring-web
			${spring.version}
		
		
			org.springframework
			spring-webmvc
			${spring.version}
		
		
			org.springframework
			spring-test
			${spring.version}
		
		
		
			org.springframework
			spring-expression
			${spring.version}
		
		
		
			org.springframework
			spring-tx
			${spring.version}
		
		
		
			org.springframework
			spring-jdbc
			${spring.version}
		
		
		
			commons-io
			commons-io
			2.4
		
		
		
			commons-fileupload
			commons-fileupload
			1.3.3
		
		
		
			commons-beanutils
			commons-beanutils
			1.9.3
		

		
		
			com.fasterxml.jackson.core
			jackson-databind
			2.9.9.3
		
		
		
			com.fasterxml.jackson.core
			jackson-core
			2.9.8
		
		
		
			com.fasterxml.jackson.core
			jackson-annotations
			2.9.8
		
		
		
			commons-logging
			commons-logging
			1.2
		
		
		
			mysql
			mysql-connector-java
			8.0.15
		

		
		
		
			javax.servlet
			jstl
			1.2
		
		
		
			javax.servlet
			javax.servlet-api
			4.0.1
			provided
		
		
		
			org.hibernate.validator
			hibernate-validator
			6.0.16.Final
		
		
		
			javax.validation
			validation-api
			2.0.1.Final
		
		
		
			junit
			junit
			4.12
			test
		
		
		
    		org.jboss.logging
    		jboss-logging
   			 3.4.1.Final
		
		

		
		
			com.alibaba
			druid
			1.1.12
		

		
		
			com.github.fangjinuo.sqlhelper
			sqlhelper-mybatis-over-pagehelper
			2.1.0
		
		
		
			javax.servlet.jsp
			javax.servlet.jsp-api
			2.3.3
			provided
		

		
		
			javax.servlet
			javax.servlet-api
			3.1.0
			provided
		


	

 

你可能感兴趣的:(SSM)