List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext refresh
@Override public void refresh() throws BeansException, IllegalStateException
From source file:pieShareAppITs.helper.ITUtil.java
public static AnnotationConfigApplicationContext getContextWithSpecialPiePlateContext(Class piePlateContext) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(PieShareUtilitiesITConfig.class); context.register(piePlateContext);/*from w ww. j a va 2 s . c o m*/ context.register(PieShareAppModelITConfig.class); context.register(PieShareAppServiceConfig.class); context.register(PieShareAppTasks.class); context.register(ProviderConfiguration.class); context.refresh(); return context; }
From source file:pieShareAppITs.helper.ITUtil.java
public static AnnotationConfigApplicationContext getContext() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(PieShareUtilitiesITConfig.class); context.register(PiePlateConfiguration.class); context.register(PieShareAppModelITConfig.class); context.register(PieShareAppServiceConfig.class); context.register(PieShareAppTasks.class); context.register(ProviderConfiguration.class); context.refresh(); return context; }
From source file:com.kurento.kmf.spring.KurentoApplicationContextUtils.java
public static AnnotationConfigApplicationContext createKurentoHandlerServletApplicationContext( Class<?> servletClass, String servletName, ServletContext sc, String handlerClassName) { Assert.notNull(sc, "Cannot create Kurento ServletApplicationContext from null ServletContext"); Assert.notNull(servletClass, "Cannot create KurentoServletApplicationContext from a null Servlet class"); Assert.notNull(servletClass, "Cannot create KurentoServletApplicationContext from a null Hanlder class"); if (childContexts == null) { childContexts = new ConcurrentHashMap<String, AnnotationConfigApplicationContext>(); }//from ww w . ja v a 2 s.c o m AnnotationConfigApplicationContext childContext = childContexts .get(servletClass.getName() + ":" + servletName); Assert.isNull(childContext, "Pre-existing context found associated to servlet class " + servletClass.getName() + " and servlet name " + servletName); childContext = new AnnotationConfigApplicationContext(); GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClassName(handlerClassName); childContext.registerBeanDefinition(handlerClassName, beanDefinition); if (!kurentoApplicationContextExists()) { createKurentoApplicationContext(sc); } childContext.setParent(getKurentoApplicationContext()); childContext.refresh(); childContexts.put(servletClass.getName(), childContext); return childContext; }
From source file:shiver.me.timbers.spring.security.integration.ITJwtConfigurationMutualExclusivity.java
@Test(expected = BeanCreationException.class) public void Cannot_apply_the_adaptor_if_the_annotation_is_present() { final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(getClass());/* w ww.ja v a 2 s. c om*/ context.refresh(); }
From source file:org.springsource.investigation.ReproTests.java
@SuppressWarnings("unchecked") @Test//from www . j a v a 2 s .c om public void repro() { ConfigurableApplicationContext parent = new GenericApplicationContext(); parent.refresh(); AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext(); child.setParent(parent); child.refresh(); ConfigurableEnvironment env = child.getBean(ConfigurableEnvironment.class); assertThat("UNKNOWN ENV", env, anyOf(sameInstance(parent.getEnvironment()), sameInstance(child.getEnvironment()))); assertThat("EXPECTED CHILD CTX ENV", env, sameInstance(child.getEnvironment())); }
From source file:org.seasar.doma.boot.autoconfigure.TryLookupEntityListenerProviderTest.java
@Test public void testNotManaged() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.refresh(); TryLookupEntityListenerProvider provider = new TryLookupEntityListenerProvider(); provider.setApplicationContext(context); FooListener listener = provider.get(FooListener.class, FooListener::new); assertThat(listener.managed, is(false)); }
From source file:org.wicketTutorial.WicketApplication.java
/** * @see org.apache.wicket.Application#init() *//* w w w .j a va2 s. c om*/ @Override public void init() { super.init(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.scan("org.wicketTutorial.ejbBean"); ctx.refresh(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, ctx)); }
From source file:org.geosdi.geoplatform.experimental.dropwizard.app.CoreServiceApp.java
@Override public void run(CoreServiceConfig t, Environment e) throws Exception { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(CoreOAuth2ServiceLoader.class); ctx.refresh(); ctx.registerShutdownHook();/*from w w w . j a v a 2 s. c o m*/ ctx.start(); e.jersey().register( new JacksonMessageBodyProvider(new GPJacksonSupport().getDefaultMapper(), e.getValidator())); e.jersey().register(new OAuth2ExceptionProvider()); e.jersey().register(new OAuthProvider<>(new CoreOAuthAuthenticator(t), "protected-resources")); e.healthChecks().register("service-health-check", new CoreServiceHealthCheck()); Map<String, Object> resources = ctx.getBeansWithAnnotation(Path.class); for (Map.Entry<String, Object> entry : resources.entrySet()) { e.jersey().register(entry.getValue()); } }
From source file:org.wicketTutorial.springinjection.WicketApplication.java
/** * @see org.apache.wicket.Application#init() *//* www . j av a 2 s .c o m*/ @Override public void init() { super.init(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.scan("org.wicketTutorial.springinjection.ejbBean"); ctx.refresh(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, ctx)); }
From source file:io.gravitee.reporter.elastic.ElasticsearchReporterTest.java
public void init() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(ReporterConfiguration.class); ctx.refresh(); this.reporter = ctx.getBean(ElasticsearchReporter.class); }