程序突然报@Value获取不到值的坑

昨天程序还好好的,然后今天死活起不来,部分报错如下

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-11-24 09:27:17,268 [restartedMain] ERROR [org.springframework.boot.SpringApplication] SpringApplication.java:826 - Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtAuthenticationTokenFilter': Unsatisfied dependency expressed through field 'tokenService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'token.header' in value "${token.header}"

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'token.header' in value "${token.header}"

 

我就先看看是不是有人提交了代码,我没更新,一看也没人提交

我就再看是不是我手抖,少了或者多了什么,更git上的版本进行对比,也没什么区别,但是在同时电脑能跑起来,我电脑就不行,我就纳闷了

然后检查yml文件也有相关的配置、使用的时候也是通过@Autowired注入,也用了@Component注解,但是还是无法获取到配置文件的值【之前进行代码对比,就没发现问题】

重启,重新build都不管用

然后一想,会不会是跟jdk的版本有关,然后我就切换jdk版本,也没用,切换启动设置里面的JRE,也是不行

最后实在没招了

maven重新reimport, WTF,项目跑起来了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值