SpringBoot--IntelliJ IDEA新建第一个demo

1.新建Spirng Initializr项目

  

2.填写项目信息

  项目使用maven管理,

  Group: 配置maven中的groupId         

  Artifact:配置maven中的artifactId

  maven中的groupId、artifactId、version唯一确定一个项目,groupId:一般为项目组(项目团队)名称    artifactId:一般为项目名称   version:项目的版本号

  

3.选择项目使用的技术

  

4.填写项目名称,选择项目存放位置

  

5.创建成功

  

6.在resource下static目录下创建index.html,启动项目(直接运行启动类的main方法)

7.项目启动成功,访问http://localhost:8080

总结:

  Spring boot可以简化Spring配置,达到快速构建项目的目的。该项目使用maven管理项目,项目结构resources :主要是放项目资源文件。

  直接使用http://localhost:8080  可以访问到index.html 是因为Spring Boot对静态首页的支持:

    把静态index.html文件放置在如下目录:

      classpath:/META-INF/resources/index.html

      classpath:/resources/index.html

      classpath:/static/index.html

      classpath:/public/index.html

    当我们访问应用根目录http://localhost:8080/时,会直接映射。

  

猜你喜欢

转载自www.cnblogs.com/ly0215-start-na/p/9273195.html