我能做这样的事吗?
private final static String myVar = "health.xyz.throughput"; @Value("${{myVar}:10}") // doesn't work of course private Integer healthThroughput;
本质上myVar键正在其他地方使用,所以想看看它是否可以移动到一个常量?
myVar
kxkpmulp1#
是的可能:
private static final String myVar = "health.xyz.throughput"; @Value("${" + myVar + ":10}") private Integer healthThroughput;
您还可以用途:
private static final String myVar = "${health.xyz.throughput:10}"; @Value(myVar) private Integer healthThroughput;
1条答案
按热度按时间kxkpmulp1#
是的可能:
您还可以用途: