第二篇:SpringBoot接口Http协议

一、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

相关文章
相关标签/搜索