You need to restart the server to modify information in the web environment. If you often restart the server in a large project, you can imagine the waste of time. Today we will introduce spring boot! Generally, learning begins with hello world! The following describes how to configure and use spring boot in maven!
Configure pom. xml first,
Xsi: schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
Authentication
Ammaven
War
0.0.1-SNAPSHOT
Ammaven Maven Webapp
Http://maven.apache.org
UTF-8
4.0.3.RELEASE
3.8.1
2.4
Org. springframework. boot
Spring-boot-starter-parent
1.0.1.RELEASE
Org. springframework. boot
Spring-boot-starter-web
Commons-fileupload
Commons-fileupload
1.3.1
Commons-io
Commons-io
$ {Common-io}
Junit
Junit
$ {Junitversion}
Test
Org. springframework
Spring-aop
$ {Springversion}
Jar
Compile
Org. springframework
Spring-aspects
$ {Springversion}
Jar
Compile
Org. springframework
Spring-beans
$ {Springversion}
Jar
Compile
Org. springframework
Spring-context
$ {Springversion}
Jar
Compile
Org. springframework
Spring-context-support
$ {Springversion}
Jar
Compile
Org. springframework
Spring-core
$ {Springversion}
Jar
Compile
Org. springframework
Spring-expression
$ {Springversion}
Jar
Compile
Org. springframework
Spring-jdbc
$ {Springversion}
Jar
Compile
Org. springframework
Spring-jms
$ {Springversion}
Jar
Compile
Org. springframework
Spring-orm
$ {Springversion}
Jar
Compile
Org. springframework
Spring-oxm
$ {Springversion}
Jar
Compile
Org. springframework
Spring-tx
$ {Springversion}
Jar
Compile
Org. springframework
Spring-web
$ {Springversion}
Jar
Compile
Org. springframework
Spring-webmvc
$ {Springversion}
Jar
Compile
Org. springframework
Spring-test
$ {Springversion}
Jar
Compile
Javax. servlet
Jstl
1.2
Jar
Compile
Commons-collections
Commons-collections
3.1
Commons-logging
Commons-logging
1.1
Ammaven
After downloading the dependent jar package, configure spring and springMVC.
First configure and applicationContext. xml
Xmlns: tx = "http://www.springframework.org/schema/tx" xmlns: aop = "http://www.springframework.org/schema/aop"
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-2.5.xsd
Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
Http://www.springframework.org/schema/context
Http://www.springframework.org/schema/context/spring-context-2.5.xsd
Http://www.springframework.org/schema/aop
Http://www.springframework.org/schema/aop/spring-aop-3.2.xsd>
Class = "org. springframework. beans. factory. config. MethodInvokingFactoryBean">
Classpath: log4j. properties
Configure spring mvc again:
Class = "org. springframework. web. servlet. i18n. CookieLocaleResolver">
Class = "org. springframework. web. multipart. commons. CommonsMultipartResolver">
Class = "org. springframework. web. servlet. view. InternalResourceViewResolver">
Finally, you need to configure web. xml
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_3_0.xsd"
Id = "WebApp_ID" version = "3.0">
MyMVC
Index. jsp
ContextConfigLocation
Classpath: applicationContext. xml
Log4jConfigLocation
Classpath: log4j. properties
Mvc
Org. springframework. web. servlet. DispatcherServlet
ContextConfigLocation
Classpath: mvc. xml
True
1
Mvc
*. Mvc
Org. springframework. web. util. Log4jConfigListener
Org. springframework. web. context. ContextLoaderListener