
springboot
隔壁会编程的猫
这个作者很懒,什么都没留下…
展开
-
SpringBoot:使用spring-boot-devtools进行热部署以及不生效的问题解决
场景:目前的Springboot,当发生了任何修改之后,必须关闭后再启动Application类才能够生效,显得略微麻烦。 Springboot提供了热部署的方式,当发现任何类发生了改变,马上通过JVM类加载的方式,加载最新的类到虚拟机中。 这样就不需要重新启动也能看到修改后的效果了1、pom.xml依赖: <!-- 热部署 --> <depe...原创 2019-06-13 19:22:09 · 3925 阅读 · 1 评论 -
SpringBoot: 全局异常处理统一办法
springboot全局异常处理统一办法:创建异常类:import org.springframework.web.bind.annotation.ControllerAdvice;import org.springframework.web.bind.annotation.ExceptionHandler;import org.springframework.web.servlet.Mo...原创 2019-06-13 20:27:56 · 235 阅读 · 0 评论 -
SpringBoot: 多配置切换
SpringBoot: 多配置切换1 、 多配置切换1、需求:有时候在本地测试是使用8080端口,可是上线使用的又是80端口。 此时就可以通过多配置文件实现多配置支持与灵活切换2、多配置文件:3个配置文件:(1)核心配置文件:application.properties(2)开发环境用的配置文件:application-dev.properties(3)生产环境用的配置文件:app...原创 2019-06-14 10:12:00 · 240 阅读 · 0 评论 -
springboot:与JPA结合出现异常Caused by: java.lang.IllegalArgumentException: Not a managed type: class xxx
1、出现异常:Caused by: java.lang.IllegalArgumentException: Not a managed type: class xxxxCaused by: java.lang.IllegalArgumentException: Not a managed type: class com.example.pojo.Category at org.hibernat...原创 2019-06-14 20:00:18 · 16483 阅读 · 2 评论 -
SpringBoot使用@Value给静态变量注入值
application-yml 配置文件配置如下:#JavaMailSender mail: host: smtp.163.com #邮箱服务器地址 username: xxxxx #发件人地址 password: xxxxx #邮箱的授权码 default-enc...原创 2019-06-25 08:35:09 · 393 阅读 · 0 评论