01 Spring Boot项目搭建

1、idea选择File->Project


image.png

2、引入lombok、web、mysql驱动


image.png

3、修改spring boot版本为2.3.0.RELEASE,修改mysql版本为5.1.47,刷新maven。修改后的pom文件如下:


    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.3.0.RELEASE
         
    
    com.example
    starter
    0.0.1-SNAPSHOT
    00Starter
    Demo project for Spring Boot
    
        1.8
    
    
        
            org.springframework.boot
            spring-boot-starter-web
        

        
            mysql
            mysql-connector-java
            runtime
            5.1.47
        
        
            org.projectlombok
            lombok
            true
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    
                        
                            org.projectlombok
                            lombok
                        
                    
                
            
        
    


4、运行application,控制台信息如下:

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

2021-12-24 14:32:20.024  INFO 11852 --- [           main] com.example.starter.Application          : Starting Application on chenzl105390 with PID 11852 (E:\gitee\chenzhenlindx\schema-validation\00Starter\target\classes started by chenzl105 in E:\gitee\chenzhenlindx\schema-validation\00Starter)
2021-12-24 14:32:20.027  INFO 11852 --- [           main] com.example.starter.Application          : No active profile set, falling back to default profiles: default
2021-12-24 14:32:20.696  INFO 11852 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-12-24 14:32:20.704  INFO 11852 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-12-24 14:32:20.704  INFO 11852 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.35]
2021-12-24 14:32:20.836  INFO 11852 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-12-24 14:32:20.836  INFO 11852 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 774 ms
2021-12-24 14:32:20.937  INFO 11852 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-12-24 14:32:21.035  INFO 11852 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-12-24 14:32:21.042  INFO 11852 --- [           main] com.example.starter.Application          : Started Application in 1.304 seconds (JVM running for 2.773)

5、打开 http://localhost:8080/ 界面如下:

image.png

你可能感兴趣的:(01 Spring Boot项目搭建)