Created
February 4, 2015 17:04
-
-
Save dmahapatro/97fc8fd571cf41a22b85 to your computer and use it in GitHub Desktop.
YAML to Groovy Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run in Grails context inside grails console | |
// Below will be helpful to create "application.groovy" from "application.yml" in Grails 3 | |
// which will be an easy porting experiance from Grails 2.* to Grails 3 | |
// In future, this can be added to a grails command and/or added to a Grails profile. | |
import org.springframework.beans.factory.config.YamlMapFactoryBean | |
import org.springframework.core.io.ClassPathResource | |
import org.springframework.core.io.Resource | |
YamlMapFactoryBean factory = new YamlMapFactoryBean() | |
factory.setResources( [ new ClassPathResource( 'application.yml' ) ] as Resource[] ) | |
new ConfigObject( factory.object ) //.toProperties() if required |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment