我想覆盖我在使用它的项目中编写的库属性。我正在使用这个 Spring 指南来创建库:https://spring.io/guides/gs/multi-module/
我想知道如何覆盖使用我的库的项目中的例如 my.properties 文件。
这可能吗?
最佳答案
不要将 application.properties 文件添加到库中。它可能会导致无数问题。如果你想设置默认属性,请像这样设置:
@ConfigurationProperties("foo")
public class FooConfig {
private int bar = 999;
// getter / setter
}
每个应用程序都应该在自己的 application.properties 文件中配置自己的库值。
关于java - 如何覆盖 Spring Boot 库属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56383963/