org.springframework.context.annotation.AnnotationConfigApplicationContext.setId()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(71)

本文整理了Java中org.springframework.context.annotation.AnnotationConfigApplicationContext.setId()方法的一些代码示例,展示了AnnotationConfigApplicationContext.setId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotationConfigApplicationContext.setId()方法的具体详情如下:
包路径:org.springframework.context.annotation.AnnotationConfigApplicationContext
类名称:AnnotationConfigApplicationContext
方法名:setId

AnnotationConfigApplicationContext.setId介绍

暂无

代码示例

代码示例来源:origin: gravitee-io/gravitee-gateway

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;
}

代码示例来源:origin: stackoverflow.com

AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
// all other initialisation part ...
// before! refresh
ctx.setId("portal-lasg-appCtx-id");
// now refresh ..
ctx.refresh();
ctx.start();

代码示例来源:origin: org.kuali.common/kuali-util

/**
 * 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());
  }
}

代码示例来源:origin: org.kuali.common/kuali-util

/**
 * 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());
  }
}

代码示例来源:origin: com.enioka.jqm/jqm-handler-spring

ctx.setId(handlerParameters.get("contextId"));

代码示例来源:origin: enioka/jqm

ctx.setId(handlerParameters.get("contextId"));

代码示例来源:origin: io.gravitee.am.gateway.handlers/gravitee-am-gateway-handler

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;
}

代码示例来源:origin: gravitee-io/graviteeio-access-management

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;
}

代码示例来源:origin: alien4cloud/alien4cloud

fullApplicationContext.setId(this.bootstrapContext.getId() + ":full");
fullApplicationContext.register(FullApplicationConfiguration.class);
fullApplicationContext.refresh();

代码示例来源:origin: infiniteautomation/ma-core-public

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();
}

代码示例来源:origin: com.fitbur.testify.junit/spring-integration-test

appContext.setId(testClassName);
appContext.setAllowBeanDefinitionOverriding(true);
appContext.setAllowCircularReferences(false);

代码示例来源:origin: org.testifyproject.di/di-spring

AnnotationConfigApplicationContext configContext =
    (AnnotationConfigApplicationContext) applicationContext;
configContext.setId(testContext.getName());
configContext.setDisplayName(testContext.getName());
configContext.setAllowCircularReferences(false);

相关文章

微信公众号

最新文章

更多

AnnotationConfigApplicationContext类方法