简体   繁体   English

使用 application.properties 中的旧值

[英]Using old value from application.properties

I've change one value in application.properties (accessed in code by class annoted by @ConfigurationProperties), rebuilt module but during running application I see that old value (before application.properties edition) is being used.我已经更改了 application.properties 中的一个值(由 @ConfigurationProperties 注释的 class 在代码中访问),重建模块但在运行应用程序期间我看到旧值(在 application.properties 版本之前)正在使用。 In "target" directory I see that current value is being stored.在“目标”目录中,我看到正在存储当前值。 What could go wrong here? go 有什么问题?

Off the top of my head, things that could go wrong, in no particular order:在我的脑海中,可能 go 错误的事情,没有特别的顺序:

  • There is a specific profile (like dev, local or prod) in force that uses the old value.有一个使用旧值的有效配置文件(如 dev、local 或 prod)。 In Spring, if profile is activated, then the properties defined in application-profile.properties takes precedence over the ones with the same name defined in the generic application.properties在 Spring 中,如果激活了profile ,则application-profile.properties中定义的属性优先于通用application.properties中定义的同名属性
  • There is an application.properties file in your classpath that takes precedence over the one in the target directory/in the jar/war/ear.类路径中有一个 application.properties 文件,它优先于目标目录/jar/war/ear 中的文件。 The one in the target dir is the one with the least precedence.目标目录中的那个是优先级最低的。
  • You haven't cleaned your project before building在构建之前你还没有清理你的项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM