简体   繁体   中英

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM