External properties file in grails 3

前端 未结 6 1291
猫巷女王i
猫巷女王i 2021-02-08 00:32

I need read configuration from a external file properties in grails 3. In grails 2.x I link the file with:

grails.config.locations = [\"classpath:config.propert         


        
6条回答
  •  爱一瞬间的悲伤
    2021-02-08 01:04

    I am having the same problem to read the properties file from external location in Grails 3. I found this plugin which helpme to read the properties from external location. It has feature to read .yml, .groovy files as well.

    Follow the steps mentioned in the documentation and it will work. The steps are like:

    1. Add dependency in build.gradle:

      dependencies {compile 'org.grails.plugins:external-config:1.2.2'}
      
    2. Add this in application.yml grails:

      config:
          locations:
              - file:///opt/abc/application.yml
      
    3. Create file at external location. In my case /opt/abc/application.yml.

    4. Build the application and run.

提交回复
热议问题