Spring Boot 使用JSP时,修改JSP不生效,需要重启的现象
来源:互联网 发布:什么软件看爱奇艺会员 编辑:程序博客网 时间:2024/06/09 20:57
问题描述
公司项目用的Spring Boot,自己也就对他多研究一些,之前自己练习的Spring Boot项目,都是使用的JSP,在修改后直接刷新页面就可以看到效果,今天升级Spring Boot版本后,发现修改JSP后直接刷新页面没有用了。。。重启才能生效。。。问题定位
什么问题都抵不住爱折腾的心,我原以为更换了IDE(试了试IDEA这个工具)导致的,换回原来的Eclipse惊奇的发现也是无效的。
有想了想,觉得是不是因为修改POM文件添加了其他的jar包导致的(使用了shiro做权限,和redis做缓存),直接重新建一个Spring Boot项目,写了最简单的Controller,发现还是不行。。。哔了狗了。
各种尝试,想着难不成是Spring Boot版本升级导致的(从1.3.1升到了1.5.1)?换回1.3.1,擦!真的可以了问题原因
百度。。。木有答案,看来遇到的问题人还不多。。。
直接上stackoverflow,终于看到原因。在Spring Boot的GitHub上,有个大神(好吧,看来真的是很 牛 逼的大神)建议
spring-boot recompiles JSPs periodically leading to an unacceptable performance loss in production environments.This behaviour is counter intuitive and hard to find.The recompilation is behind a switch now but it's turned on (means it's in dev mode all the time).I suggest to turn it off by default and enable it via the spring-boot-devtools.The switch I am talking about is:server.jsp-servlet.init-parameters.development
大致是说:spring-boot对JSP的重新编译会导致不可接受性能降低在生产环境上。找出这个现象是啥啥啥并且艰难的。 。。。
我建议默认关闭并且通过spring-boot-devtools来开启它(指JSP修改后立即重新编译) 。。。
而这个开关我觉得可以是这样的:
server.jsp-servlet.init-parameters.development
官方文档:
JSP servletThe JSP servlet is no longer in development mode by default. Development mode is automatically enabled when using DevTools. It can also be enabled explicitly by setting server.jsp-servlet.init-parameters.development=true.
- 解决方案
好吧,废话多了,解决方案如下
在配置文件application.properties中添加如下配置:
server.jsp-servlet.init-parameters.development=true
解决问题。
4 0
- Spring Boot 使用JSP时,修改JSP不生效,需要重启的现象
- Spring Boot 使用JSP时,修改JSP不生效,需要重启的现象
- Spring Boot 1.5+ 使用JSP时,修改JSP不生效,需要重启的现象
- Spring-boot JSP修改后需要重启才能生效的问题
- JSp文件修改不生效的解决办法
- 解决方案:Jboss修改jsp需要重启才生效
- Jboss修改jsp需要重启才生效
- 使用Eclipse修改JSP页面需要重启tomcat的解决方法
- 使用Eclipse修改JSP页面需要重启tomcat的解决方法
- IntelliJ IDEA之项目热部署设置,解决为什么修改jsp或html页面,需要重启服务才能生效!
- Jsp文件修改后不生效怎么办?
- Spring-Boot使用jsp
- spring boot 使用jsp 的一些问题
- [DELVE][web]解决jsp修改后,修改的内容需要重启tomcat才能刷新出来
- Spring boot(11) 使用jsp
- 13. Spring Boot 使用JSP
- Spring Boot + JSP(官方不推荐)
- Idea使用记录--每次修改JS文件都需要重启Idea才能生效解决方法
- c++第二次实验:本月有几天?
- Handler系列一---存在问题,改进,使用之
- Spring boot CommandLineRunner的基本使用(一):启动加载数据
- .NET WebApi上传文件接口(带其他参数)
- (懒人必备)Android开源数据库LitePal
- Spring Boot 使用JSP时,修改JSP不生效,需要重启的现象
- TabLayout新样式
- 【Mybatis】(五)一级缓存和二级缓存
- uboot源码分析-启动第一阶段
- 那些年踩过的坑-ubuntu-desktop静态IP设置
- 五、AngularJS 之服务(Service)
- C/C++ 知识回顾 单链表基本操作
- 2. 可视化(The caret package)
- 人机猜拳之Java面向对象小游戏