Package org.grails.config

Examples of org.grails.config.PropertySourcesConfig


            if(parentContext != null) {

                org.springframework.core.env.Environment environment = parentContext.getEnvironment();
                if(environment instanceof ConfigurableEnvironment) {
                    MutablePropertySources propertySources = ((ConfigurableEnvironment) environment).getPropertySources();
                    this.config = new PropertySourcesConfig(propertySources);
                }
            }
            else {
                this.config = new PropertySourcesConfig();
                if(ClassUtils.isPresent("Config", classLoader)) {
                    try {
                        ConfigObject co = new ConfigSlurper().parse(ClassUtils.forName("Config", classLoader));
                        this.config.merge(co);
                    } catch (ClassNotFoundException e) {
View Full Code Here


            beanNameBlacklistPattern = blacklistPattern;
        }
    }
   
    public ChainedTransactionManagerPostProcessor() {
        this(new PropertySourcesConfig(), null, null);
    }
View Full Code Here

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        org.springframework.core.env.Environment environment = applicationContext.getEnvironment();
        if(environment instanceof ConfigurableEnvironment) {
            MutablePropertySources propertySources = ((ConfigurableEnvironment) environment).getPropertySources();
            PropertySourcesConfig newConfig = new PropertySourcesConfig(propertySources);
            if(this.config != null) {
                newConfig.merge(this.config);
            }
            this.config = newConfig;
        }
        this.parentContext = applicationContext;
    }
View Full Code Here

        Holders.setConfig(config);
        updateFlatConfig();
    }

    public void setConfig(ConfigObject config) {
        this.config = new PropertySourcesConfig().merge(config);
        Holders.setConfig(this.config);
        updateFlatConfig();
    }
View Full Code Here

        MockApplicationContext appCtx = new MockApplicationContext();
        appCtx.registerMockBean(GroovyPagesUriService.BEAN_ID, new DefaultGroovyPagesUriService());

        DefaultGrailsApplication grailsApplication = new DefaultGrailsApplication();
        grailsApplication.setConfig(config);
        Holders.setConfig(new PropertySourcesConfig().merge(config));
        appCtx.registerMockBean(GrailsApplication.APPLICATION_ID, grailsApplication);
        appCtx.getServletContext().setAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT, appCtx);
        appCtx.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appCtx);
        return GrailsWebMockUtil.bindMockWebRequest(appCtx);
    }
View Full Code Here

        return grailsApplication.getFlatConfig();
    }

    public Config getConfig() {
        if(grailsApplication == null) {
            return new PropertySourcesConfig();
        }
        return grailsApplication.getConfig();
    }
View Full Code Here

* @since 2.4.0
*/
public class StandaloneGrailsApplication extends AbstractGrailsApplication {
    public StandaloneGrailsApplication() {
        super();
        setConfig(new PropertySourcesConfig());
    }
View Full Code Here

    public void testOverridingDefaultTemplateViaConfig() throws Exception {
            ConfigObject config = new ConfigSlurper().parse("grails.sitemesh.default.layout='otherApplication'");
            MutablePropertySources propertySources = new MutablePropertySources();
            propertySources.addLast(new MapPropertySource("grails", config));

            GrailsWebRequest webRequest = buildMockRequest(new PropertySourcesConfig(propertySources));
            webRequest.setAttribute(GrailsLayoutDecoratorMapper.RENDERING_VIEW, Boolean.TRUE, RequestAttributes.SCOPE_REQUEST);
            MockApplicationContext appCtx = (MockApplicationContext)webRequest.getApplicationContext();
            appCtx.registerMockResource("/grails-app/views/layouts/application.gsp", "<html><body><h1>Default Layout</h1><g:layoutBody /></body></html>");
            appCtx.registerMockResource("/grails-app/views/layouts/otherApplication.gsp", "<html><body><h1>Other Default Layout</h1><g:layoutBody /></body></html>");
View Full Code Here

TOP

Related Classes of org.grails.config.PropertySourcesConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.