spring boot 提示 could not resolve placeholder in string value
程序员文章站
2022-06-01 09:12:46
...
1.问题描述
spring boot在实体类中引用yml中的配置
@Value("${shiro.session.expireTime}")
private final int expireTime = 30;
一启动项目,就报错,提示could not resolve placeholder in string value,该错误基本上就是【找不到配置文件引起的(application.yml)】
2.解决方法
检查下target/classes目录下是否存在application.yml配置文件
如果存在,可在配置类上添加PropertySource主键根据错误日志判断是否存在application.yml配置文件。
@Configuration
@PropertySource("classpath:application.yml")
public class ShiroConfig {
上一篇: 序列化与反序列化
下一篇: 【微服务】Springboot和ActiveMQ整合出现 Could not resolve placeholder 'xxx' in value "${xxx}"
推荐阅读
-
asp.net mvc项目使用spring.net发布到IIS后,在访问提示错误 Could not load type from string value 'DALMsSql.DBSessionFactory,DALMsSql'.
-
spring boot 提示 could not resolve placeholder in string value
-
spring cloud config 配置管理出现 Could not resolve placeholder 'hello' in value "${hello}"
-
spring cloud远程配置 Could not resolve placeholder 'gname' in value "${gname}"
-
asp.net mvc项目使用spring.net发布到IIS后,在访问提示错误 Could not load type from string value 'DALMsSql.DBSessionFactory,DALMsSql'.
-
spring boot Could not resolve placeholder 'xxx' in value "${xxx}"