GORM: Encrypted Password for datasource

时间:2017-10-12 09:40:38

标签: grails gorm jasypt

I am using grails 3.3.0 and GORM for my web application.

The DB password is encrypted and provided by Database team and placed in application.yml

dataSource:
    username: root
    password: ASDFASFCvcsdfaefsdsf!@#11

I am using jasypt plug-in for grails and able to decrypt the encrypted properties but by that time GORM has already initialized with encrypted password. How do I update or configure my GORM?

Do let me know if you need any further information.

1 个答案:

答案 0 :(得分:1)

您可以在启动上下文之前更改Application.groovy处的dataSource.password属性,类似于:

class Application extends GrailsAutoConfiguration {
   static void main(String[] args) {
      System.env['dataSource.password'] = 'unencripted'
      GrailsApp.run Application, args
   }
}