How do I apply calculations on the springs @ value property?

application.properties:
application.properties:
//timeout in ms
timeout = 20000;

@Value("${timeout} / 1000")
private int timeoutInSeconds;

Can I apply some calculations directly on the @ value property? At least my example doesn't work like this

Solution

Answer my own question:

@Value(“#{${timeout} / 1000}”)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>