脚本宝典收集整理的这篇文章主要介绍了java-study-springboot-基础学习-05-springboot web开发,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
SPRingBoot 之web开发
1、自动配置类说明
Web开发的自动配置类: org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
比如:
spring mvc的前后缀配置
在WebMvcAutoConfiguration中对应方法
对应配置文件
2、静态资源配置说明
如果进入SpringMVC的规则为/时,SpringBoot的默认静态资源的路径为:
spring.resources.static-locations=classpath:/META-iNF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
如果某个静态文件不在上面的配置路径中,那么从浏览器中就访问不到了
3、自定义消息转化器
- 原有的spring mvc 配置
- springboot 配置
4、自定义拦截器
- 继承org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
以上是脚本宝典为你收集整理的java-study-springboot-基础学习-05-springboot web开发全部内容,希望文章能够帮你解决java-study-springboot-基础学习-05-springboot web开发所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。