【发布时间】:2020-11-17 17:02:54
【问题描述】:
我试图让这个 @Value 在 @Embeddable pojo 类中运行,但该值始终为 false。所有 application.properties 文件都正确填写。这可能是不可能的,因为它没有服务/控制器/配置?
@Embeddable
public class WebDestination implements Serializable {
@Value("${property.example}")
private boolean example;
public boolean isExample() {
return example;
}
public void setExample(boolean example) {
this.example= example;
}
}
【问题讨论】:
-
如果你愿意,不用 Spring 也可以做到:stackoverflow.com/questions/40835785/…
标签: java spring-boot