membersound
membersound

Reputation: 86687

How to apply calculation on Springs @Value properties?

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

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

Is it possible to apply some calculations directly on a @Value attribute? At least my example does not work this way...

Upvotes: 4

Views: 2237

Answers (1)

membersound
membersound

Reputation: 86687

To answer my own question:

@Value("#{${timeout} / 1000}")

Upvotes: 14

Related Questions