ConfigurationProperties无法将yml或properties中的内容读取到bean解决方法
81 字
1 分钟
ConfigurationProperties无法将yml或properties中的内容读取到bean解决方法
注意:读取到静态属性中 springboot无法通过给静态变量赋值,在对应字段的set方法去掉static即可。
//这两个注解必不可少@Component@ConfigurationProperties(prefix = "test")public class TestConfig{
/** 验证码类型 */ private static String captchaType;
public static String getCaptchaType() { return captchaType; }
public void setCaptchaType(String captchaType) { TestConfig.captchaType = captchaType; }}文章分享
如果这篇文章对你有帮助,欢迎分享给更多人!
ConfigurationProperties无法将yml或properties中的内容读取到bean解决方法
https://czxcly.cn/posts/configurationproperties无法将yml或properties中的内容读取到bean解决方法/ 相关文章 智能推荐
1
多模块项目公共类配置文件加载方法
技术文章 多模块项目公共类配置文件加载方法
2
SpringBoot项目[禁止OPTIONS等不安全的请求]增加OPTIONS不安全请求处理
技术文章 SpringBoot项目[禁止OPTIONS等不安全的请求]增加OPTIONS不安全请求处理
3
SpringBoot集成QQ邮箱发送邮件
技术文章 SpringBoot集成QQ邮箱发送邮件
4
springboot-jar包启动提示没有主清单属性
技术文章 springboot-jar包启动提示没有主清单属性
5
彻底卸载谷歌浏览器残留
其它教程 彻底卸载谷歌浏览器残留
随机文章 随机推荐