mirzak
mirzak

Reputation: 1047

Variables inside application.properties

Is there a way to save value inside variable and reuse it inside application.properties.

If I have something like :

 spring.datasource.username: root
 spring.datasource.password: root

I would like to reuse it like :

org.quartz.dataSource.timermicroservice.user = ${spring.datasource.username}
org.quartz.dataSource.timermicroservice.password = ${spring.datasource.password}

Or something similar. Is there a way for thing like this ?

Upvotes: 2

Views: 3422

Answers (1)

mirzak
mirzak

Reputation: 1047

I was not able to do it like mentioned in question since Quartz uses plain Java, but in Spring it is different. So I did it like

spring.datasource.username = ${org.quartz.dataSource.timermicroservice.user}
spring.datasource.password = ${org.quartz.dataSource.timermicroservice.password}

This works.

Upvotes: 2

Related Questions