Package org.grails.spring

Examples of org.grails.spring.RuntimeSpringConfiguration


    }

    public void reloadPlugin(GrailsPlugin plugin) {
        plugin.doArtefactConfiguration();

        RuntimeSpringConfiguration springConfig = new DefaultRuntimeSpringConfiguration(parentCtx);

        doRuntimeConfiguration(plugin.getName(), springConfig);
        springConfig.registerBeansWithContext((GenericApplicationContext)applicationContext);

        plugin.doWithApplicationContext(applicationContext);
        plugin.doWithDynamicMethods(applicationContext);
    }
View Full Code Here


                .addBeanFactoryPostProcessor(postProcessor);
        }
    }

    public void reconfigure(GrailsApplicationContext current, ServletContext servletContext, boolean loadExternalBeans) {
        RuntimeSpringConfiguration springConfig = parent != null ? new DefaultRuntimeSpringConfiguration(parent) : new DefaultRuntimeSpringConfiguration();
        Assert.state(pluginManager.isInitialised(),
                "Cannot re-configure Grails application when it hasn't even been configured yet!");

        pluginManager.doRuntimeConfiguration(springConfig);

        List<String> beanNames = springConfig.getBeanNames();
        for (Object beanName : beanNames) {
            String name = (String) beanName;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Re-creating bean definition [" + name + "]");
            }
            current.registerBeanDefinition(name, springConfig.createBeanDefinition(name));
            // force initialisation
            current.getBean(name);
        }
        pluginManager.doDynamicMethods();
        pluginManager.doPostProcessing(current);
View Full Code Here

    }

    public void testDoWithApplicationContext() {
        GrailsPlugin versionPlugin = new DefaultGrailsPlugin(versioned, ga);

        RuntimeSpringConfiguration springConfig = new DefaultRuntimeSpringConfiguration();
        versionPlugin.doWithRuntimeConfiguration(springConfig);

        ApplicationContext ctx = springConfig.getApplicationContext();

        assertTrue(ctx.containsBean("classEditor"));

        versionPlugin.doWithApplicationContext(ctx);
    }
View Full Code Here

    }

    public void testDoWithRuntimeConfiguration() {
        GrailsPlugin versionPlugin = new DefaultGrailsPlugin(versioned, ga);

        RuntimeSpringConfiguration springConfig = new DefaultRuntimeSpringConfiguration();
        versionPlugin.doWithRuntimeConfiguration(springConfig);

        ApplicationContext ctx = springConfig.getApplicationContext();

        assertTrue(ctx.containsBean("classEditor"));
    }
View Full Code Here

        GroovyClassLoader gcl = new GroovyClassLoader();
        gcl.parseClass("class Holder { def value }");
        /*Class<?> resourcesClass =*/ gcl.parseClass("beans = { b(Holder, value: application); b2(Holder, value: grailsApplication) }", "resources.groovy");

        GrailsApplication app = new DefaultGrailsApplication(new Class[]{}, gcl);
        RuntimeSpringConfiguration springConfig = new DefaultRuntimeSpringConfiguration();
        GrailsRuntimeConfigurator.loadExternalSpringConfig(springConfig, app);

        for (String bean : new String[] { "b", "b2" }) {
            assertTrue(springConfig.containsBean(bean));
            BeanConfiguration beanConfig = springConfig.getBeanConfig(bean);
            assertTrue(beanConfig.hasProperty("value"));
            assertEquals(app, beanConfig.getPropertyValue("value"));
        }
    }
View Full Code Here

TOP

Related Classes of org.grails.spring.RuntimeSpringConfiguration

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.