Learn the time reference of this tutorial, http://blog.csdn.net/lxhjh/article/details/51751847.
--------------------------------------------------------------------------------------------------------------- ------------------------------
Several issues were identified:
1.SpringBoot can be started directly in the form of the run as Java application, it does save the configuration XML, to add engineering to Tomcat, the process of starting Tomcat is also the start of Java application.
2.SpringBoot The Tomcat 8080 port is automatically released when Eclipse is turned off, and no more manual turn off Tomcat release 8080 is required.
3. Find the annotation for the class where the main function is springbootapplication, and the main function has a sentence springapplication.run ( Springbootsamplehelloworldapplication.class, args), and requires Introduced packages for org.springframework.boot.SpringApplication and org.springframework.boot.autoconfigure.SpringBootApplication, guess here is the direct Sprin Gbootapplication is placed in springapplication as a component, and because Springbootapplication is under the Autoconfigure package, Guess this is what the so-called Springboot can automatically configure.
4. After discovering that Springboot is running, it seems useless to modify the logic in controller again, such as modifying the output of the corresponding path, and the output of the modification is actually the same. I feel like I've seen a ghost. , there are problems elsewhere, but nothing has been found.
5. Finally, it is found that the controller is located in a package that does not seem to be consistent with the Springboot package.
Most of the above for speculation, specific springboot content to look forward to follow-up learning.
--------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------
Here is a log of the port problems encountered:
is actually a 8080 port occupancy problem,
Problem scenario: At first, because you want to test the relative position of springboot and restcontroller problem, the wrong write two identical springboot, the previous started, then started another, prompted Port occupancy, the end of the article for the Consolo prompt content.
workaround : Simply turn off Javaw.exe directly to the task Manager. Here you find the cmd input in admin run mode NETSTAT-ABN can see all the connected programs, very magical (really is too dish). )。
output of the Consolo :
(should be a spring letter graphic, may be the reason for encoding, display a problem, for the moment, go backward)
. ____ _ __ _ _
/\\ / ___‘_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | ' _ | ' _| | ' _ \ _ ' | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____|. __|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot:: (v1.5.4.release)
2017-06-24 18:37:53.878 INFO 3712---[main]. e.springbootsamplehelloworldapplication:starting Springbootsamplehelloworldapplication on Oqbnbm1je2s28li with PID 3712 (Z:\ChromeDownloads\ Spring-boot-sample-helloworld\spring-boot-sample-helloworld\target\classes started by Administrator in Z:\ Chromedownloads\spring-boot-sample-helloworld\spring-boot-sample-helloworld)
2017-06-24 18:37:53.885 INFO 3712---[main]. E.springbootsamplehelloworldapplication:no Active profile set, falling BA CK to default Profiles:default
2017-06-24 18:37:54.215 INFO 3712---[main] ationconfigembeddedwebapplicationcontext:refreshing Org.springframework.boot[email protected]4f51b3e0:startup Date [Sat June 18:37:54 CST 2017]; Root of context Hierarchy
2017-06-24 18:37:59.653 INFO 3712---[main] s.b.c.e.t.tomcatembeddedservletcontainer:tomcat initialized with Port (s): 8080 (http)
2017-06-24 18:37:59.692 INFO 3712---[main] o.apache.catalina.core.standardservice:starting service [Tomcat]
2017-06-24 18:37:59.695 INFO 3712---[main] org.apache.catalina.core.StandardEngine:Starting Servlet Engine:apache to mcat/8.5.15
2017-06-24 18:37:59.964 INFO 3712---[ost-startstop-1] o.a.c.c.c.[tomcat]. [localhost]. [/]: Initializing Spring embedded Webapplicationcontext
2017-06-24 18:37:59.965 INFO 3712---[ost-startstop-1] o.s.web.context.contextloader:root WebApplicationContext: Initialization completed in 5765 MS
2017-06-24 18:38:00.296 INFO 3712---[ost-startstop-1] o.s.b.w.servlet.servletregistrationbean:mapping servlet: ' Dispatcherservlet ' to [/]
2017-06-24 18:38:00.307 INFO 3712---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Characterencodingfilter ' to: [/*]
2017-06-24 18:38:00.308 INFO 3712---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Hiddenhttpmethodfilter ' to: [/*]
2017-06-24 18:38:00.309 INFO 3712---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Httpputformcontentfilter ' to: [/*]
2017-06-24 18:38:00.309 INFO 3712---[ost-startstop-1] o.s.b.w.servlet.filterregistrationbean:mapping filter: ' Requestcontextfilter ' to: [/*]
2017-06-24 18:38:01.106 INFO 3712---[main] s.w.s.m.m.a.requestmappinghandleradapter:looking for @ControllerAdvice: or G.springframework.boot[email protected]4f51b3e0:startup Date [Sat June 18:37:54 CST 2017]; Root of context Hierarchy
2017-06-24 18:38:01.328 INFO 3712---[main] s.w.s.m.m.a.requestmappinghandlermapping:mapped "{[/hello/{name}]}" onto P Ublic java.lang.String com.example.HelloController.helloName (java.lang.String)
2017-06-24 18:38:01.330 INFO 3712---[main] s.w.s.m.m.a.requestmappinghandlermapping:mapped "{[/]}" onto public java.l Ang. String Com.example.HelloController.helloWorld ()
2017-06-24 18:38:01.335 INFO 3712---[main] s.w.s.m.m.a.requestmappinghandlermapping:mapped "{[/error]}" onto public o Rg.springframework.http.responseentity<java.util.map<java.lang.string, java.lang.Object>> Org.springframework.boot.autoconfigure.web.BasicErrorController.error (Javax.servlet.http.HttpServletRequest)
2017-06-24 18:38:01.337 INFO 3712---[main] 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)
2017-06-24 18:38:01.446 INFO 3712---[main] o.s.w.s.handler.simpleurlhandlermapping:mapped URL path [/webjars/**] onto handler of type [class Org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-24 18:38:01.448 INFO 3712---[main] o.s.w.s.handler.simpleurlhandlermapping:mapped URL path [/**] onto handler of type [class Org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-24 18:38:01.586 INFO 3712---[main] o.s.w.s.handler.simpleurlhandlermapping:mapped URL path [/**/favicon.ico] onto handler of type [class Org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-24 18:38:01.931 INFO 3712---[main] o.s.j.e.a.annotationmbeanexporter:registering beans for JMX exposure on St Artup
2017-06-24 18:38:02.190 ERROR 3712---[main] o.a.coyote.http11.http11nioprotocol:failed to start end point associated With Protocolhandler ["http-nio-8080"]
Java.net.BindException:Address already in Use:bind
At Sun.nio.ch.Net.bind0 (Native Method) ~[na:1.8.0_77]
At Sun.nio.ch.Net.bind (net.java:433) ~[na:1.8.0_77]
At Sun.nio.ch.Net.bind (net.java:425) ~[na:1.8.0_77]
At Sun.nio.ch.ServerSocketChannelImpl.bind (serversocketchannelimpl.java:223) ~[na:1.8.0_77]
At Sun.nio.ch.ServerSocketAdaptor.bind (serversocketadaptor.java:74) ~[na:1.8.0_77]
At Org.apache.tomcat.util.net.NioEndpoint.bind (nioendpoint.java:210) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
At Org.apache.tomcat.util.net.AbstractEndpoint.start (abstractendpoint.java:978) ~[tomcat-embed-core-8.5.15.jar : 8.5.15]
At Org.apache.coyote.AbstractProtocol.start (abstractprotocol.java:628) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
At Org.apache.catalina.connector.Connector.startInternal (connector.java:1022) [Tomcat-embed-core-8.5.15.jar : 8.5.15]
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150) [tomcat-embed-core-8.5.15.jar:8.5.15]
At Org.apache.catalina.core.StandardService.addConnector (standardservice.java:225) [Tomcat-embed-core-8.5.15.jar : 8.5.15]
At Org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors ( TOMCATEMBEDDEDSERVLETCONTAINER.JAVA:250) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start ( tomcatembeddedservletcontainer.java:193) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer ( embeddedwebapplicationcontext.java:297) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh ( embeddedwebapplicationcontext.java:145) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:546) [ Spring-context-4.3.9.release.jar:4.3.9.release]
At Org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh ( embeddedwebapplicationcontext.java:122) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.SpringApplication.refresh (springapplication.java:693) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Org.springframework.boot.SpringApplication.refreshContext (springapplication.java:360) [ Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.SpringApplication.run (springapplication.java:303) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Org.springframework.boot.SpringApplication.run (springapplication.java:1118) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Org.springframework.boot.SpringApplication.run (springapplication.java:1107) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Com.example.SpringBootSampleHelloworldApplication.main (springbootsamplehelloworldapplication.java:10) [ Classes/:na]
2017-06-24 18:38:02.191 ERROR 3712---[main] o.apache.catalina.core.standardservice:failed to start connector [Connect OR[HTTP/1.1-8080]]
org.apache.catalina.LifecycleException:Failed to start component [connector[http/1.1-8080]
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:167) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
At Org.apache.catalina.core.StandardService.addConnector (standardservice.java:225) ~[ TOMCAT-EMBED-CORE-8.5.15.JAR:8.5.15]
At Org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors ( TOMCATEMBEDDEDSERVLETCONTAINER.JAVA:250) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start ( tomcatembeddedservletcontainer.java:193) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer ( embeddedwebapplicationcontext.java:297) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh ( embeddedwebapplicationcontext.java:145) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:546) [ Spring-context-4.3.9.release.jar:4.3.9.release]
At Org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh ( embeddedwebapplicationcontext.java:122) [Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.SpringApplication.refresh (springapplication.java:693) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Org.springframework.boot.SpringApplication.refreshContext (springapplication.java:360) [ Spring-boot-1.5.4.release.jar:1.5.4.release]
At Org.springframework.boot.SpringApplication.run (springapplication.java:303) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Org.springframework.boot.SpringApplication.run (springapplication.java:1118) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Org.springframework.boot.SpringApplication.run (springapplication.java:1107) [Spring-boot-1.5.4.release.jar : 1.5.4.RELEASE]
At Com.example.SpringBootSampleHelloworldApplication.main (springbootsamplehelloworldapplication.java:10) [ Classes/:na]
caused By:org.apache.catalina.LifecycleException:service.getName (): "Tomcat"; Protocol Handler start failed
At Org.apache.catalina.connector.Connector.startInternal (connector.java:1029) ~[tomcat-embed-core-8.5.15.jar : 8.5.15]
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
... Common frames omitted
caused by:java.net.BindException:Address already in Use:bind
At Sun.nio.ch.Net.bind0 (Native Method) ~[na:1.8.0_77]
At Sun.nio.ch.Net.bind (net.java:433) ~[na:1.8.0_77]
At Sun.nio.ch.Net.bind (net.java:425) ~[na:1.8.0_77]
At Sun.nio.ch.ServerSocketChannelImpl.bind (serversocketchannelimpl.java:223) ~[na:1.8.0_77]
At Sun.nio.ch.ServerSocketAdaptor.bind (serversocketadaptor.java:74) ~[na:1.8.0_77]
At Org.apache.tomcat.util.net.NioEndpoint.bind (nioendpoint.java:210) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
At Org.apache.tomcat.util.net.AbstractEndpoint.start (abstractendpoint.java:978) ~[tomcat-embed-core-8.5.15.jar : 8.5.15]
At Org.apache.coyote.AbstractProtocol.start (abstractprotocol.java:628) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
At Org.apache.catalina.connector.Connector.startInternal (connector.java:1022) ~[tomcat-embed-core-8.5.15.jar : 8.5.15]
... Common frames omitted
2017-06-24 18:38:02.225 INFO 3712---[main] o.apache.catalina.core.standardservice:stopping service [Tomcat]
2017-06-24 18:38:02.281 INFO 3712---[main] utoconfigurationreportlogginginitializer:
Error starting ApplicationContext. To display the Auto-configuration report re-run your application with ' debug ' enabled.
2017-06-24 18:38:02.328 ERROR 3712---[main] o.s.b.d.loggingfailureanalysisreporter:
***************************
Application FAILED to START
***************************
Description:
The TOMCAT connector configured to listen in port 8080 failed to start. The port may already is in use or the connector is misconfigured.
Action:
Verify the connector ' s configuration, identify and stop any process that's listening on port 8080, or configure this appli cation to listen on another port.
2017-06-24 18:38:02.334 INFO 3712---[main] ationconfigembeddedwebapplicationcontext:closing Org.springframework.boot[email protected]4f51b3e0:startup Date [Sat June 18:37:54 CST 2017]; Root of context Hierarchy
2017-06-24 18:38:02.345 INFO 3712---[main] o.s.j.e.a.annotationmbeanexporter:unregistering jmx-exposed beans on Shutd Own
--------------------------------------------------------------------------------------------------------------- -------
OK, this is the first blog I wrote, write the Luo Li Bar, but the feeling is quite fun, and how to feel I always write incoherent, full of nonsense? Anyway, look forward to the post can be written well.
Beginner Springboot One