《搭建SpringBoot的基本步骤》

1、检查环境

    (1)查看jdk版本 java -version

       《搭建SpringBoot的基本步骤》

(2) 查看maven版本  mvn -version

     《搭建SpringBoot的基本步骤》


2、创建maven 项目

    目录结构为:

    《搭建SpringBoot的基本步骤》

3、加入springboot相关jar包的依赖

《搭建SpringBoot的基本步骤》

《搭建SpringBoot的基本步骤》

4、创建运行主类

《搭建SpringBoot的基本步骤》

5、创建控制层类

《搭建SpringBoot的基本步骤》


6、运行application类

7、运行结果

《搭建SpringBoot的基本步骤》

说明:供学习记录使用。


8、总结

(1)需要检查环境

(2)pom.xml文件中引入springboot相关jar包。

(3)创建运行主类

       标签说明

     @SpringBootApplication 标记为运行主类

    @ComponentScan(basePackages = {"org.xxjr.*"}) 定义启动扫描的包路径

(4)默认端口为8080.访问路径为localhost:8080