sprint boot automatically create web applications (3)

1. springboot automatically creates the address: https: //start.spring.io/

2. Select the web (springMVC)

3. Click Create

4. Create Success

5. decompression, introducing item

 

 6. New Success

 7. The reason: plug-in version of the maven of problems, resulting in incompatible with the IDE

The solution: add <maven-jar-plugin.version> 3.1.1 </maven-jar-plugin.version> in pom on it

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
    </properties>

 8. Project Right -maven-updata project

 

9. Start project

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.0.RELEASE)

2019-11-03 12:51:06.730  INFO 7196 --- [           main] c.x.springboot.ControllerApplication     : Starting ControllerApplication on PC-20190411SFOQ with PID 7196 (D:\Downloads\com.xiaobing.springboot_v1\target\classes started by Administrator in D:\Downloads\com.xiaobing.springboot_v1)
2019-11-03 12:51:06.752  INFO 7196 --- [           main] c.x.springboot.ControllerApplication     : No active profile set, falling back to default profiles: default
2019-11-03 12:51:22.173  INFO 7196 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-11-03 12:51:23.416  INFO 7196 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-11-03 12:51:23.417  INFO 7196 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-03 12:51:24.883  INFO 7196 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-11-03 12:51:24.884  INFO 7196 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 17724 ms
2019-11-03 12:51:26.409  INFO 7196 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-03 12:51:30.032  INFO 7196 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-03 12:51:30.049  INFO 7196 --- [           main] c.x.springboot.ControllerApplication     : Started ControllerApplication in 27.012 seconds (JVM running for 31.285)

10.web access

 11. Create a new class mapping class

package com.xiaobing.springboot;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class Example {

    @RequestMapping("/")
    String home() {
        return "Hello World!";
    }
}

12. Restart Project

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.0.RELEASE)

2019-11-03 13:01:44.699  INFO 7192 --- [           main] c.x.springboot.ControllerApplication     : Starting ControllerApplication on PC-20190411SFOQ with PID 7192 (D:\Downloads\com.xiaobing.springboot_v1\target\classes started by Administrator in D:\Downloads\com.xiaobing.springboot_v1)
2019-11-03 13:01:44.712  INFO 7192 --- [           main] c.x.springboot.ControllerApplication     : No active profile set, falling back to default profiles: default
2019-11-03 13:01:48.641  INFO 7192 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-11-03 13:01:48.711  INFO 7192 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-11-03 13:01:48.712  INFO 7192 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-03 13:01:49.121  INFO 7192 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-11-03 13:01:49.122  INFO 7192 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4166 ms
2019-11-03 13:01:49.694  INFO 7192 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-03 13:01:50.262  INFO 7192 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-03 13:01:50.272  INFO 7192 --- [           main] c.x.springboot.ControllerApplication     : Started ControllerApplication in 6.845 seconds (JVM running for 8.017)

13. Access web project

 Log Print

2019-11-03 13:02:51.079  INFO 7192 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-11-03 13:02:51.080  INFO 7192 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-11-03 13:02:51.107  INFO 7192 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 26 ms

14. The study concluded, follow-perfect!

Guess you like

Origin www.cnblogs.com/xiaozhaoboke/p/11784912.html