快速搭建一个简单的spring+maven工程

1.maven依赖



	
		4.3.6.RELEASE
		1.3.2
	

	
		
			junit
			junit
			3.8.1
			test
		


		
		
			org.springframework
			spring-webmvc
			${spring.version}
		

		
			org.springframework
			spring-jdbc
			${spring.version}
		

		
			org.springframework
			spring-context
			${spring.version}
		

		
			org.springframework
			spring-aop
			${spring.version}
		

		
			org.springframework
			spring-core
			${spring.version}
		

		
			org.springframework
			spring-test
			${spring.version}
		
		
			javax.servlet
			javax.servlet-api
			3.0.1
			provided
		
		
			javax.servlet
			jstl
			1.2
			provided
		
		
			javax.servlet.jsp
			javax.servlet.jsp-api
			2.3.1
			provided
		
		
			org.mybatis
			mybatis
			3.2.8
		
		
			org.mybatis
			mybatis-spring
			1.2.2
		
		
			com.alibaba
			druid
			1.0.18
		
		
			org.apache.httpcomponents
			httpclient
			4.5.1
		
		
			com.alibaba
			fastjson
			1.2.24
		
		
			log4j
			log4j
			1.2.16
		
		
			mysql
			mysql-connector-java
			5.1.40
		
		
			org.codehaus.jackson
			jackson-mapper-asl
			1.9.8
			jar
			compile
		
		
			com.fasterxml.jackson.core
			jackson-databind
			2.6.5
		

		
			com.fasterxml.jackson.core
			jackson-core
			2.6.5
		

		
			com.fasterxml.jackson.core
			jackson-annotations
			2.6.5
		
		
			org.springframework.data
			spring-data-mongodb
			1.10.1.RELEASE
		
		
	



	
		
			
				
					org.apache.maven.plugins
					maven-resources-plugin
					2.4.3
					
						utf-8
					
				
				
					org.apache.tomcat.maven
					tomcat7-maven-plugin
					2.1
					
						9090
						/oma
						UTF-8
						oma
						tomcat7
					
				
			
		
	







    


    
    


这个地方有疑问可以参考一下这个 http://blog.csdn.net/xiaojiahao_kevin/article/details/51584600
2.创建文件目录如图

快速搭建一个简单的spring+maven工程_第1张图片


3.测试效果

 	ApplicationContext ac=new ClassPathXmlApplicationContext("classpath*:META_INF/spring/*.xml");
//        System.out.println( "Hello World!" );
    	HelloService helloService=(HelloService)ac.getBean(HelloService.class);
    	helloService.say();

结果

六月 05, 2016 3:31:37 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7eda2dbb: startup date [Sun Jun 05 15:31:37 GMT+08:00 2016]; root of context hierarchy
六月 05, 2016 3:31:37 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [C:\workspace\eclipse\spring\target\classes\META_INF\spring\application-context.xml]
Hello world





 
 

你可能感兴趣的:(快速搭建一个简单的spring+maven工程)