org.springframework.context.support.ClassPathXmlApplicationContext.setAllowBeanDefinitionOverriding()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(130)

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

ClassPathXmlApplicationContext.setAllowBeanDefinitionOverriding介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-batch

@Test
  public void testAllowBeanOverrideFalse() {
    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
    applicationContext.setAllowBeanDefinitionOverriding(false);
    applicationContext.setConfigLocation("org/springframework/batch/core/configuration/xml/BeanDefinitionOverrideTests-context.xml");
    applicationContext.refresh();
  }
}

代码示例来源:origin: spring-projects/spring-security

@Test
public void registerDataValueProcessorOnlyIfNotRegistered() throws Exception {
  try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext()) {
    context.setAllowBeanDefinitionOverriding(false);
    context.setConfigLocation(this.xml("RegisterDataValueProcessorOnyIfNotRegistered"));
    context.refresh();
  }
}

代码示例来源:origin: spring-projects/spring-integration

context.setAllowBeanDefinitionOverriding(false);
context.setConfigLocations(new String[]{"classpath:org/springframework/integration/channel/channel-override-config.xml"});
context.setParent(parentContext);

代码示例来源:origin: org.dspace/dspace-services-impl

applicationContext = new ClassPathXmlApplicationContext(allPaths, false);
applicationContext.setAllowBeanDefinitionOverriding(true);
applicationContext.setAllowCircularReferences(false);

代码示例来源:origin: org.dspace/dspace-services

applicationContext = new ClassPathXmlApplicationContext(allPaths, false);
applicationContext.setAllowBeanDefinitionOverriding(true);
applicationContext.setAllowCircularReferences(true);

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

@Override
public void startup() {
  long startTime = System.currentTimeMillis();
  // get all spring config paths
  String[] allPaths = getSpringPaths(testMode, configPaths, configurationService);
  applicationContext = new ClassPathXmlApplicationContext(allPaths, false);
  // Make sure that the spring files from the config directoy can override the spring files from our jars
  applicationContext.setAllowBeanDefinitionOverriding(true);
  applicationContext.setAllowCircularReferences(true);
  //applicationContext.registerShutdownHook(); // this interferes with the kernel shutdown hook
  // add the config interceptors (partially done in the xml)
  applicationContext
    .addBeanFactoryPostProcessor(new DSpaceBeanFactoryPostProcessor(parent, configurationService, testMode));
  applicationContext.refresh();
  if (developmentMode) {
    log.warn("Spring Service Manager is running in developmentMode, services will be loaded on demand only");
    // TODO find a way to set this sucker to super duper lazy mode? it is currently not actually doing it
  } else {
    applicationContext.getBeanFactory().preInstantiateSingletons();
    applicationContext.getBeanFactory().freezeConfiguration();
  }
  long totalTime = System.currentTimeMillis() - startTime;
  log.info("Spring Service Manager started up in " + totalTime + " ms with " + applicationContext
    .getBeanDefinitionCount() + " services...");
}

相关文章

微信公众号

最新文章

更多