New MANV Project:
<?xml version= "1.0" encoding= "UTF-8"? ><project xmlns= "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/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <groupId> Spring-boot</groupid> <artifactId>com.liwen</artifactId> <version>1.0-snapshot</ version> <!--Spring Boot parent dependency, the introduction of this post-related introduction does not need to add a version configuration, Spring boot will automatically select the most appropriate version to add. -<parent> <groupId>org.springframework.boot</groupId> <artifactid>spring-bo ot-starter-parent</artifactid> <version>1.4.3.RELEASE</version> </parent> <propert Ies> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!--Specify the version of the JDK, which We use JDK 1.8, default is 1.6-<java.version>1.8</java.version> </properties> <dependencies> <!--spring-boot-starter-web:mvc,aop Dependency pack ...-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId> Spring-boot-starter-web</artifactid> <!--<version></version> Since we specified the parent (Spring boot)-</dependency> <!--to add the Fastjson dependency package. -<dependency> <groupId>com.alibaba</groupId> <artifactid>fastjs On</artifactid> <version>1.2.15</version> </dependency> <!--spring Bo OT devtools dependent packages. -<dependency> <groupId>org.springframework.boot</groupId> <ARTIFAC Tid>spring-boot-devtools</artifactid> <optional>true</optional> <scope>tr Ue</scope> </dependency> </dependencies></project>
Create a new class file
package com.liwen;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class HellCotroller { @RequestMapping("/hello") public String Hello() { return "liwen good!"; }}
Run
package com.liwen;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublic class Appmin { public static void main(String[] args) { SpringApplication.run(Appmin.class,args); }}
Results
"D:\Program Files\java\jdk1.8.0_31\bin\java"-xx:tieredstopatlevel=1-noverify-dspring.output.ansi.enabled=always -dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=35212- Dcom.sun.management.jmxremote.authenticate=false-dcom.sun.management.jmxremote.ssl=false- Djava.rmi.server.hostname=localhost-dspring.livebeansview.mbeandomain-dspring.application.admin.enabled=true "- Javaagent:d:\program Files\jetbrains\intellij Idea 2018.1\lib\idea_rt.jar=35213:d:\program Files\JetBrains\ IntelliJ idea 2018.1\bin "-dfile.encoding=utf-8-classpath" D:\Program files\java\jdk1.8.0_31\jre\lib\charsets.jar;d : \program Files\java\jdk1.8.0_31\jre\lib\deploy.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\ Access-bridge-64.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\c3p0-0.9.1.2.jar;d:\program Files\Java\ Jdk1.8.0_31\jre\lib\ext\cldrdata.jar;d:\program files\java\jdk1.8.0_31\jre\lib\ext\commons-collections.jar;d:\ Program Files\java\jdk1.8.0_31\jre\lib\ext\commons-dbcp-1.3.jar;d:\proGram Files\java\jdk1.8.0_31\jre\lib\ext\commons-pool.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\dnsns.jar ;D: \program Files\java\jdk1.8.0_31\jre\lib\ext\jaccess.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\ Jfxrt.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\localedata.jar;d:\program Files\Java\jdk1.8.0_31\jre\lib \ext\mysql-connector-java-5.1.7-bin.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\nashorn.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\sunec.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\sunjce_provider.jar ;D: \program Files\java\jdk1.8.0_31\jre\lib\ext\sunmscapi.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\ Sunpkcs11.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\ext\zipfs.jar;d:\program Files\Java\jdk1.8.0_31\jre\lib\ Javaws.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\jce.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\jfr.jar;d : \program Files\java\jdk1.8.0_31\jre\lib\jfxswt.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\jsse.jar;d:\ Program Files\jAva\jdk1.8.0_31\jre\lib\management-agent.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\plugin.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\resources.jar;d:\program Files\java\jdk1.8.0_31\jre\lib\rt.jar;d:\tool\ideaspace \comliwen\target\classes; C:\Users\lw.m2\repository\org\springframework\boot\spring-boot-starter-web\1.4.3.RELEASE\ Spring-boot-starter-web-1.4.3.release.jar; C:\Users\lw.m2\repository\org\springframework\boot\spring-boot-starter\1.4.3.RELEASE\ Spring-boot-starter-1.4.3.release.jar; C:\Users\lw.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.4.3.RELEASE\ Spring-boot-starter-logging-1.4.3.release.jar; C:\Users\lw.m2\repository\ch\qos\logback\logback-classic\1.1.8\logback-classic-1.1.8.jar; C:\Users\lw.m2\repository\ch\qos\logback\logback-core\1.1.8\logback-core-1.1.8.jar; C:\Users\lw.m2\repository\org\slf4j\slf4j-api\1.7.22\slf4j-api-1.7.22.jar; C:\Users\lw.m2\repository\org\slf4j\jcl-over-slf4j\1.7.22\jcl-over-slf4j-1.7.22.jar; C:\Users\lw.m2\repository\org\slF4j\jul-to-slf4j\1.7.22\jul-to-slf4j-1.7.22.jar; C:\Users\lw.m2\repository\org\slf4j\log4j-over-slf4j\1.7.22\log4j-over-slf4j-1.7.22.jar; C:\Users\lw.m2\repository\org\springframework\spring-core\4.3.5.RELEASE\spring-core-4.3.5.RELEASE.jar; C:\Users\lw.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar; C:\Users\lw.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.4.3.RELEASE\ Spring-boot-starter-tomcat-1.4.3.release.jar; C:\Users\lw.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.6\tomcat-embed-core-8.5.6.jar; C:\Users\lw.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.6\tomcat-embed-el-8.5.6.jar; C:\Users\lw.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.6\ Tomcat-embed-websocket-8.5.6.jar; C:\Users\lw.m2\repository\org\hibernate\hibernate-validator\5.2.4.Final\hibernate-validator-5.2.4.Final.jar; C:\Users\lw.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar; C:\Users\lw.m2\repository\org\jboss\logging\jboss-logging\3.3.0.final\jboss-logging-3.3.0.final.jar; C:\Users\lw.m2\repository\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar; C:\Users\lw.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.5\jackson-databind-2.8.5.jar; C:\Users\lw.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.5\jackson-annotations-2.8.5.jar; C:\Users\lw.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.5\jackson-core-2.8.5.jar; C:\Users\lw.m2\repository\org\springframework\spring-web\4.3.5.RELEASE\spring-web-4.3.5.RELEASE.jar; C:\Users\lw.m2\repository\org\springframework\spring-aop\4.3.5.RELEASE\spring-aop-4.3.5.RELEASE.jar; C:\Users\lw.m2\repository\org\springframework\spring-beans\4.3.5.RELEASE\spring-beans-4.3.5.RELEASE.jar; C:\Users\lw.m2\repository\org\springframework\spring-context\4.3.5.RELEASE\spring-context-4.3.5.RELEASE.jar; C:\Users\lw.m2\repository\org\springframework\spring-webmvc\4.3.5.RELEASE\spring-webmvc-4.3.5.RELEASE.jar; C:\Users\lw.m2\repository\org\spriNgframework\spring-expression\4.3.5.release\spring-expression-4.3.5.release.jar; C:\Users\lw.m2\repository\com\alibaba\fastjson\1.2.15\fastjson-1.2.15.jar; C:\Users\lw.m2\repository\org\springframework\boot\spring-boot-devtools\1.4.3.RELEASE\ Spring-boot-devtools-1.4.3.release.jar; C:\Users\lw.m2\repository\org\springframework\boot\spring-boot\1.4.3.RELEASE\spring-boot-1.4.3.RELEASE.jar; C:\Users\lw.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.4.3.RELEASE\ Spring-boot-autoconfigure-1.4.3.release.jar "Com.liwen.Appmin
. _ _
/\/ ' _ () \ \ \ \ \ \ \ \
( ( )\ | ' | '| | ' \ \ ' | \ \ \ \
\/ _)| | )| | | | | || (| | ) ) ) )
' |__|. | | || | | \, | / / / /
=========|_|==============|__/=////
:: Spring Boot:: (v1.4.3.release)
2018-06-08 20:31:05.284 INFO 47016---[restartedmain] com.liwen.Appmin:Starting appmin on liwen-pc with PID 47016 (d:\ Tool\ideaspace\comliwen\target\classes started by LW in D:\TOOL\IDEASpace\comliwen)
2018-06-08 20:31:05.288 INFO 47016---[restartedmain] com.liwen.Appmin:No active profile set, falling back to default Profiles:default
2018-06-08 20:31:05.539 INFO 47016---[Restartedmain] ationconfigembeddedwebapplicationcontext:refreshing Org.springframework.boot[email protected]7a5c4347:startup Date [Fri June 20:31:05 CST 2018]; Root of context Hierarchy
2018-06-08 20:31:07.800 INFO 47016---[restartedmain] s.b.c.e.t.tomcatembeddedservletcontainer:tomcat initialized wit H Port (s): 8080 (http)
2018-06-08 20:31:07.813 INFO 47016---[restartedmain] o.apache.catalina.core.standardservice:starting service Tomcat
2018-06-08 20:31:07.814 INFO 47016---[restartedmain] org.apache.catalina.core.StandardEngine:Starting Servlet Engine : Apache tomcat/8.5.6
2018-06-08 20:31:07.929 INFO 47016---[ost-startstop-1] o.a.c.c.c.[tomcat]. [localhost]. [/]: Initializing Spring embedded Webapplicationcontext
2018-06-08 20:31:07.929 INFO 47016---[ost-startstop-1] o.s.web.context.contextloader:root WebApplicationContext: Initialization completed in 2395 MS
2018-06-08 20:31:08.160 INFO 47016---[ost-startstop-1] o.s.b.w.servlet.servletregistrationbean:mapping servlet: ' Dispatcherservlet ' to [/]
2018-06-08 20:31:08.167 INFO 47016---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Characterencodingfilter ' to: [/]
2018-06-08 20:31:08.168 INFO 47016---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Hiddenhttpmethodfilter ' to: [/]
2018-06-08 20:31:08.168 INFO 47016---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Httpputformcontentfilter ' to: [/]
2018-06-08 20:31:08.168 INFO 47016---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Requestcontextfilter ' to: [/]
2018-06-08 20:31:08.709 INFO 47016---[Restartedmain] s.w.s.m.m.a.requestmappinghandleradapter:looking for @Controlle Radvice:org.springframework.boot[email protected]7a5c4347:startup Date [Fri June 20:31:05 CST 2018]; Root of context Hierarchy
2018-06-08 20:31:08.809 INFO 47016---[Restartedmain] s.w.s.m.m.a.requestmappinghandlermapping:mapped "{[/hello]}" on To public java.lang.String Com.liwen.HellCotroller.Hello ()
2018-06-08 20:31:08.815 INFO 47016---[Restartedmain] s.w.s.m.m.a.requestmappinghandlermapping:mapped "{[/error]}" on To public org.springframework.http.responseentity<java.util.map<java.lang.string, java.lang.Object>> Org.springframework.boot.autoconfigure.web.BasicErrorController.error (Javax.servlet.http.HttpServletRequest)
2018-06-08 20:31:08.816 INFO 47016---[Restartedmain] s.w.s.m.m.a.requestmappinghandlermapping:mapped "{[/error], Produces=[text/html]} "onto public org.springframework.web.servlet.ModelAndView Org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml ( Javax.servlet.http.httpservletrequest,javax.servlet.http.httpservletresponse)
2018-06-08 20:31:08.889 INFO 47016---[restartedmain] o.s.w.s.handler.simpleurlhandlermapping:mapped URL Path [/webjar s/] onto handler of type [class Org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-06-08 20:31:08.889 INFO 47016---[restartedmain] o.s.w.s.handler.simpleurlhandlermapping:mapped URL path [/] onto handler of type [class Org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-06-08 20:31:09.035 INFO 47016---[restartedmain] o.s.w.s.handler.simpleurlhandlermapping:mapped URL Path [/**/fav Icon.ico] onto handler of type [class Org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-06-08 20:31:09.342 INFO 47016---[restartedmain] o.s.b.d.a.optionallivereloadserver:livereload server is running On Port 35729
2018-06-08 20:31:09.441 INFO 47016---[restartedmain] o.s.j.e.a.annotationmbeanexporter:registering beans for JMX Expo Sure on startup
2018-06-08 20:31:09.512 INFO 47016---[Restartedmain] s.b.c.e.t.tomcatembeddedservletcontainer:tomcat started on port ( s): 8080 (http)
2018-06-08 20:31:09.524 INFO 47016---[restartedmain] com.liwen.Appmin:Started appmin in 5.379 seconds (JVM running fo R 11.402)
2018-06-08 20:31:49.510 INFO 47016---[nio-8080-exec-1] o.a.c.c.c.[tomcat]. [localhost]. [/]: Initializing Spring frameworkservlet ' Dispatcherservlet '
2018-06-08 20:31:49.510 INFO 47016---[nio-8080-exec-1] o.s.web.servlet.dispatcherservlet:frameworkservlet ' Dispatcherservlet ': Initialization started
2018-06-08 20:31:49.536 INFO 47016---[nio-8080-exec-1] o.s.web.servlet.dispatcherservlet:frameworkservlet ' Dispatcherservlet ': Initialization completed in + MS
Spring-boot Environment Construction