springboot入门

一、Springboot的HelloWorld

闲来无事,再次跑了下springboot的hello world

但发现无论怎么用http请求访问都不行。记得上次也遇到同样问题。但没记载下来.

错误如下:

后来看控制台发现:

springboot后面默认"/"即可访问。

及时总结,不要在同样的地方浪费时间。

具体代码请参考springboot官方的quickly start

https://projects.spring.io/spring-boot/#quick-start

二、springboot的代码结构如下:

启动是Application.java

配置文件config,在这里我使用properties,但也可以使用yaml进行配置:

 文件名称约定为:application.properties

文件位置约定位于:/config

 采用springMVC时静态资源的目录约定为:/static

注意:springboot后台访问html需要模板引擎。

 模板引擎约定访问路径:/templates

原文地址:https://www.cnblogs.com/limingxian537423/p/8401663.html