How change property values at runtime in Spring

后端 未结 3 1102
生来不讨喜
生来不讨喜 2020-12-17 20:05

I need change properties in my application at runtime. For example I have a service which send a e-mail with resset password. Request is valid 12 hours. But I want to chang

3条回答
  •  一个人的身影
    2020-12-17 20:56

    It's not a good practice to change value from property files using @Value("${hours.expired}"). If your change any value from property file,you need to restart your server or re-run application. so its better to store hours.expired value in Database. You can easily update whenever you want.

提交回复
热议问题