1
有没有办法将值保存在变量中并在application.properties中重用它。application.properties中的变量
如果我有这样的:
spring.datasource.username: root
spring.datasource.password: root
我想重新使用它,如:
org.quartz.dataSource.timermicroservice.user = ${spring.datasource.username}
org.quartz.dataSource.timermicroservice.password = ${spring.datasource.password}
或类似的东西。有这样的事情吗?
你试过这种方式吗?因为在我看来,这是正确的做法 – DamCx
是的,我有。得到 - >“无法加载driverClass $ {spring.datasource.driverClassName}” – mirzak
也许你需要使用PropertyPlaceholderConfigurer来实现你想要做的事情。 下面是一个示例:https://www.mkyong.com/spring/spring-propertyplaceholderconfigurer-example/ – DamCx