Search in sources :

Example 1 with AppContextInitializedEvent

use of com.haulmont.cuba.core.sys.events.AppContextInitializedEvent in project cuba by cuba-platform.

the class AbstractAppContextLoader method initAppContext.

protected void initAppContext() {
    String configProperty = AppContext.getProperty(SPRING_CONTEXT_CONFIG);
    if (StringUtils.isBlank(configProperty)) {
        throw new IllegalStateException("Missing " + SPRING_CONTEXT_CONFIG + " application property");
    }
    StrTokenizer tokenizer = new StrTokenizer(configProperty);
    String[] locations = tokenizer.getTokenArray();
    replaceLocationsFromConf(locations);
    ApplicationContext appContext = createApplicationContext(locations);
    AppContext.Internals.setApplicationContext(appContext);
    Events events = AppBeans.get(Events.NAME);
    events.publish(new AppContextInitializedEvent(appContext));
    log.debug("AppContext initialized");
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) Events(com.haulmont.cuba.core.global.Events) AppContextInitializedEvent(com.haulmont.cuba.core.sys.events.AppContextInitializedEvent) StrTokenizer(org.apache.commons.lang.text.StrTokenizer)

Example 2 with AppContextInitializedEvent

use of com.haulmont.cuba.core.sys.events.AppContextInitializedEvent in project cuba by cuba-platform.

the class TestContainer method initAppContext.

protected void initAppContext() {
    EclipseLinkCustomizer.initTransientCompatibleAnnotations();
    String configProperty = AppContext.getProperty(AbstractAppContextLoader.SPRING_CONTEXT_CONFIG);
    StrTokenizer tokenizer = new StrTokenizer(configProperty);
    List<String> locations = tokenizer.getTokenList();
    locations.add(getSpringConfig());
    springAppContext = new CubaCoreApplicationContext(locations.toArray(new String[locations.size()]));
    AppContext.Internals.setApplicationContext(springAppContext);
    Events events = AppBeans.get(Events.NAME);
    events.publish(new AppContextInitializedEvent(springAppContext));
}
Also used : AppContextInitializedEvent(com.haulmont.cuba.core.sys.events.AppContextInitializedEvent) StrTokenizer(org.apache.commons.lang.text.StrTokenizer)

Aggregations

AppContextInitializedEvent (com.haulmont.cuba.core.sys.events.AppContextInitializedEvent)2 StrTokenizer (org.apache.commons.lang.text.StrTokenizer)2 Events (com.haulmont.cuba.core.global.Events)1 ApplicationContext (org.springframework.context.ApplicationContext)1