一、SpringBoot HTTP請求配置css
簡介:SpringBoot2.xHTTP請求註解講解和簡化註解配置技巧html
一、@RestController and @RequestMapping是springMVC的註解,不是springboot特有的
二、@RestController = @Controller+@ResponseBody
三、@SpringBootApplication = @Configuration+@EnableAutoConfiguration+@ComponentScanjava
二、SpringBoot 目錄文件結構講解
簡介:講解SpringBoot目錄文件結構和官方推薦的目錄規範spring
一、目錄
src/main/java:存放代碼
src/main/resources
static: 存放靜態文件,好比 css、js、image, (訪問方式 http://localhost:8080/js/main.js)
templates:存放靜態頁面jsp,html,tpl
config:存放配置文件,application.properties
resources:springboot
二、引入依賴 Thymeleaf
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
注意:若是不引人這個依賴包,html文件應該放在默認加載文件夾裏面,
好比resources、static、public這個幾個文件夾,才能夠訪問app
三、同個文件的加載順序,靜態資源文件
Spring Boot 默認會挨個從
META/resources > resources > static > public 裏面找是否存在相應的資源,若是有則直接返回jsp