java-study-springboot-基础学习-05-springboot web开发

发布时间:2019-11-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了java-study-springboot-基础学习-05-springboot web开发脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

SPRingBoot 之web开发

1、自动配置类说明

Web开发的自动配置类: org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
clipboard.png

clipboard.png
比如:
spring mvc的前后缀配置

java-study-springboot-基础学习-05-springboot web开发


在WebMvcAutoConfiguration中对应方法

java-study-springboot-基础学习-05-springboot web开发


对应配置文件

java-study-springboot-基础学习-05-springboot web开发

2、静态资配置说明

如果进入SpringMVC的规则为/时,SpringBoot的默认静态资源的路径为:
spring.resources.static-locations=classpath:/META-iNF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
如果某个静态文件不在上面的配置路径中,那么从浏览器中就访问不到了

3、自定义消息转化器

  • 原有的spring mvc 配置

java-study-springboot-基础学习-05-springboot web开发

  • springboot 配置

java-study-springboot-基础学习-05-springboot web开发

4、自定义拦截器

  • 继承org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter

参考:https://github.com/chengbingh...

脚本宝典总结

以上是脚本宝典为你收集整理的java-study-springboot-基础学习-05-springboot web开发全部内容,希望文章能够帮你解决java-study-springboot-基础学习-05-springboot web开发所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。