【实战问题】【1】@PostConstruct 服务启动后加载两次的问题

@PostConstruct:在服务启动时触发操作(我是用来更新微信的access_token)

解决方法:

 tomcat文件夹→conf→server.xml→将appBase="webapps"置为appBase="",docBase="myapp"置为docBase="webapps/myapp"

注:印象中是Tomcat的配置问题,但是项目已经改为了SpringBoot + Maven了,有点无法确定。参考博客的内容和我印象中是相符的

参考博客:

1,Tomcat增加Context配置导致启动的时候项目加载两次 - 大鸿 - SegmentFault 思否 https://segmentfault.com/a/1190000002985203

原文地址:https://www.cnblogs.com/huashengweilong/p/10402577.html