AbstractApplicationContext createApplicationContext(Api api) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.setParent(gatewayApplicationContext); context.setClassLoader(new ReactorHandlerClassLoader(gatewayApplicationContext.getClassLoader())); context.setEnvironment((ConfigurableEnvironment) gatewayApplicationContext.getEnvironment()); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setEnvironment(gatewayApplicationContext.getEnvironment()); context.addBeanFactoryPostProcessor(configurer); context.getBeanFactory().registerSingleton("api", api); context.register(ApiHandlerConfiguration.class); context.setId("context-api-" + api.getId()); context.refresh(); return context; }
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); // all other initialisation part ... // before! refresh ctx.setId("portal-lasg-appCtx-id"); // now refresh .. ctx.refresh(); ctx.start();
/** * Add id and display name to the ApplicationContext if they are not blank */ protected void addMetaInfo(AnnotationConfigApplicationContext ctx, SpringContext sc) { if (!StringUtils.isBlank(sc.getId())) { ctx.setId(sc.getId()); } if (!StringUtils.isBlank(sc.getDisplayName())) { ctx.setDisplayName(sc.getDisplayName()); } }
/** * Add id and display name to the ApplicationContext if they are not blank */ protected void addMetaInfo(AnnotationConfigApplicationContext ctx, SpringContext sc) { if (!StringUtils.isBlank(sc.getId())) { ctx.setId(sc.getId()); } if (!StringUtils.isBlank(sc.getDisplayName())) { ctx.setDisplayName(sc.getDisplayName()); } }
ctx.setId(handlerParameters.get("contextId"));
ctx.setId(handlerParameters.get("contextId"));
AbstractApplicationContext createApplicationContext(Domain domain) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.setParent(gatewayApplicationContext); context.setClassLoader(new ReactorHandlerClassLoader(gatewayApplicationContext.getClassLoader())); context.setEnvironment((ConfigurableEnvironment) gatewayApplicationContext.getEnvironment()); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setEnvironment(gatewayApplicationContext.getEnvironment()); context.addBeanFactoryPostProcessor(configurer); context.getBeanFactory().registerSingleton("domain", domain); context.register(HandlerConfiguration.class); context.setId("context-domain-" + domain.getId()); context.refresh(); return context; }
AbstractApplicationContext createApplicationContext(Domain domain) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.setParent(gatewayApplicationContext); context.setClassLoader(new ReactorHandlerClassLoader(gatewayApplicationContext.getClassLoader())); context.setEnvironment((ConfigurableEnvironment) gatewayApplicationContext.getEnvironment()); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setEnvironment(gatewayApplicationContext.getEnvironment()); context.addBeanFactoryPostProcessor(configurer); context.getBeanFactory().registerSingleton("domain", domain); context.register(HandlerConfiguration.class); context.setId("context-domain-" + domain.getId()); context.refresh(); return context; }
fullApplicationContext.setId(this.bootstrapContext.getId() + ":full"); fullApplicationContext.register(FullApplicationConfiguration.class); fullApplicationContext.refresh();
protected CompletableFuture<ApplicationContext> springRuntimeContextInitialize() { @SuppressWarnings("resource") AnnotationConfigApplicationContext runtimeContext = new AnnotationConfigApplicationContext(); runtimeContext.setId(MangoWebApplicationInitializer.RUNTIME_CONTEXT_ID); runtimeContext.getEnvironment().getPropertySources().addLast(new MangoPropertySource("envProps", Common.envProps)); runtimeContext.register(MangoRuntimeContextConfiguration.class); runtimeContext.refresh(); runtimeContext.start(); return MangoRuntimeContextConfiguration.getFutureRuntimeContext(); }
appContext.setId(testClassName); appContext.setAllowBeanDefinitionOverriding(true); appContext.setAllowCircularReferences(false);
AnnotationConfigApplicationContext configContext = (AnnotationConfigApplicationContext) applicationContext; configContext.setId(testContext.getName()); configContext.setDisplayName(testContext.getName()); configContext.setAllowCircularReferences(false);