1

My application.properties file looks like this

#jwt
app.jwt.secret=RandomSecretKey
#1 day
app.jwt.expiration-in-ms=86400000
app.jwt.token.prefix=Bearer
app.jwt.header.string=Authorization

support.email=admin@xyz.co
spring.mail.host=smtpout.asia.secureserver.net
spring.mail.port=465
spring.mail.protocol=smtps
spring.mail.username=admin@xyz.co
spring.mail.password=******
spring.mail.properties.mail.transport.protocol=smtps
spring.mail.properties.mail.smtps.auth=true
spring.mail.properties.mail.smtps.starttls.enable=true
spring.mail.properties.mail.smtps.timeout=8000

I want to remove them from this file and set them by retrieving the values from database using JPA repositories. How to do this?

Ram
  • 1,225
  • 2
  • 24
  • 48
  • There are different ways to achieve this. But what i don't understand from your question is you need to override JPA specific properties also? eg: spring.jpa.database-platform? Why do you need to do this. Why can't you pass this arguments via environment variables at the time of deployment? – Justin Mathew Feb 16 '22 at 16:01
  • @JustinMathew I didn't notice that, edited. – Ram Feb 16 '22 at 16:23

1 Answers1

1

You can use consul.io to store and get your properties.

So if you use consul it's possible update the properties values at runtime using the annotation @RefreshScope

Example: https://www.baeldung.com/spring-cloud-consul