当前位置: 首页>>代码示例>>Java>>正文


Java PropertyOverrideConfigurer类代码示例

本文整理汇总了Java中org.springframework.beans.factory.config.PropertyOverrideConfigurer的典型用法代码示例。如果您正苦于以下问题:Java PropertyOverrideConfigurer类的具体用法?Java PropertyOverrideConfigurer怎么用?Java PropertyOverrideConfigurer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PropertyOverrideConfigurer类属于org.springframework.beans.factory.config包,在下文中一共展示了PropertyOverrideConfigurer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: propertyOverrideConfigurer

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
/**
 * Overrides properties configured on beans.
 */
@Bean()
@Lazy(false)
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public static BeanFactoryPostProcessor propertyOverrideConfigurer() {
    PropertyOverrideConfigurer theOverrideConfigurer = new PropertyOverrideConfigurer();

    final Properties thePropertiesHolder = new Properties();
    /* Task refresh interval. */
    thePropertiesHolder.put("starterService.taskReschedulingCronExpression", "0/20 * * * * ?");
    /* Transport service configuration refresh interval. */
    thePropertiesHolder.put("starterService.transportServiceConfigurationRefreshCronExpression", "0/30 * * * * ?");
    /* Task execution status reports cleanup interval. */
    thePropertiesHolder.put("starterService.taskExecutionStatusCleanupCronExpression", "0/30 0/15 * * * ?");

    theOverrideConfigurer.setProperties(thePropertiesHolder);
    theOverrideConfigurer.setIgnoreInvalidKeys(false);
    theOverrideConfigurer.setIgnoreResourceNotFound(false);
    theOverrideConfigurer.setOrder(0);
    return theOverrideConfigurer;
}
 
开发者ID:krizsan,项目名称:message-cowboy,代码行数:24,代码来源:ProductionPropertyOverrides.java

示例2: propertyOverrideConfigurer

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
/**
 * Overrides properties configured on beans.
 */
@Bean()
@Lazy(false)
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public static BeanFactoryPostProcessor propertyOverrideConfigurer() {
    PropertyOverrideConfigurer theOverrideConfigurer = new PropertyOverrideConfigurer();

    final Properties thePropertiesHolder = new Properties();
    /* Task refresh interval. */
    thePropertiesHolder.put("starterService.taskReschedulingCronExpression", "* 4/30 * * * ?");
    /* Transport service configuration refresh interval. */
    thePropertiesHolder.put("starterService.transportServiceConfigurationRefreshCronExpression", "* 5/30 * * * ?");
    /* Task execution status reports cleanup interval. */
    thePropertiesHolder.put("starterService.taskExecutionStatusCleanupCronExpression", "0/5 * * * * ?");

    theOverrideConfigurer.setProperties(thePropertiesHolder);
    theOverrideConfigurer.setIgnoreInvalidKeys(false);
    theOverrideConfigurer.setIgnoreResourceNotFound(false);
    theOverrideConfigurer.setOrder(0);
    return theOverrideConfigurer;
}
 
开发者ID:krizsan,项目名称:message-cowboy,代码行数:24,代码来源:TaskExecutionStatusCleanupTestConfiguration.java

示例3: propertyOverride

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
@Test
public void propertyOverride() throws Exception {
	ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
			"contextNamespaceHandlerTests-override.xml", getClass());
	Map<String, PropertyOverrideConfigurer> beans = applicationContext
			.getBeansOfType(PropertyOverrideConfigurer.class);
	assertFalse("No PropertyOverrideConfigurer found", beans.isEmpty());
	Date date = (Date) applicationContext.getBean("date");
	Calendar calendar = Calendar.getInstance();
	calendar.setTime(date);
	assertEquals(42, calendar.get(Calendar.MINUTE));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:ContextNamespaceHandlerTests.java

示例4: iocStart

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
public static void iocStart() {
	// BeanFactory方式启动
	ConfigurableListableBeanFactory beanFactory = new XmlBeanFactory(
			new ClassPathResource("spring.xml"));

	// 读取外部properties文件属性值填充xml中的bean,property
	PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
	propertyPlaceholderConfigurer.setLocation(new ClassPathResource(
			"config.properties"));
	// 应用postProcessBeanFactory
	propertyPlaceholderConfigurer.postProcessBeanFactory(beanFactory);

	// 读取外部properties文件,覆盖xml中bean指定的property值
	PropertyOverrideConfigurer propertyOverrideConfigurer = new PropertyOverrideConfigurer();
	propertyOverrideConfigurer.setLocation(new ClassPathResource(
			"spring-adjustment.properties"));
	propertyOverrideConfigurer.postProcessBeanFactory(beanFactory);

	// CustomEditorConfigurer,对bean的property值,做类型转换支持
	CustomEditorConfigurer customEditorConfigurer = new CustomEditorConfigurer();
	Map customEditors = new HashMap();
	customEditors.put(Date.class, new DatePropertyEditor());
	customEditorConfigurer.setCustomEditors(customEditors);
	customEditorConfigurer.postProcessBeanFactory(beanFactory);

	FXNewsProvider newsProvider = (FXNewsProvider) beanFactory
			.getBean("newsProvider");
	System.out.println(newsProvider.getClientId());
	System.out.println(newsProvider.getBaseUrl());
	System.out.println(newsProvider.getAddDate().toLocaleString());
}
 
开发者ID:bdceo,项目名称:bd-codes,代码行数:32,代码来源:FXmain.java

示例5: propertyOverrideConfigurer

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
@Test
public void propertyOverrideConfigurer() {
	PropertyOverrideConfigurer bean = (PropertyOverrideConfigurer) applicationContext
			.getBean("propertyOverrideConfigurer");
	System.out.println(bean);
	assertNotNull(bean);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:8,代码来源:ApplicationContextBeanTest.java

示例6: propertyOverride

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
@Test
public void propertyOverride() throws Exception {
	ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
			"contextNamespaceHandlerTests-override.xml", getClass());
	Map<String, PropertyOverrideConfigurer> beans = applicationContext
			.getBeansOfType(PropertyOverrideConfigurer.class);
	assertFalse("No PropertyOverrideConfigurer found", beans.isEmpty());
	Date date = (Date) applicationContext.getBean("date");
	Calendar calendar = Calendar.getInstance();
	calendar.setTime(date);
	assertEquals("No properties overriden", 42, calendar.get(Calendar.MINUTE));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:13,代码来源:ContextNamespaceHandlerTests.java

示例7: getBeanClass

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
@Override
protected Class<?> getBeanClass(Element element) {
	return PropertyOverrideConfigurer.class;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:PropertyOverrideBeanDefinitionParser.java

示例8: TestComponentManagerContainer

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
/**
 * create a component manager based on a list of component.xml
 * @param configPaths a ';' seperated list of xml bean config files
 * @throws IOException
 */
public TestComponentManagerContainer(String configPaths, Properties props)  throws IOException {
	// we assume that all the jars are in the same classloader, so this will
	// not check for
	// incorrect bindings and will not fully replicate the tomcat
	// experience, but is an easier environment
	// to work within for kernel testing.
	// For a more complex structure we could use the kernel poms in the repo
	// to generate the dep list.
	if ( ComponentManager.m_componentManager != null ) {
		log.info("Closing existing Component Manager ");
		/*			
			try {
			ComponentManager.m_componentManager.close();
		} catch ( Throwable t ) {
			log.warn("Close Failed with message, safe to ignore "+t.getMessage());
		}
		*/
		log.info("Closing Complete ");
		ComponentManager.m_componentManager = null;
	}
	
	log.info("Starting Component Manager with ["+configPaths+"]");
	ComponentManager.setLateRefresh(true);

	componentManager = (SpringCompMgr) ComponentManager.getInstance();
	ConfigurableApplicationContext ac = componentManager.getApplicationContext();
	ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
	// Supply any additional configuration.
	if (props != null) {
		PropertyOverrideConfigurer beanFactoryPostProcessor = new PropertyOverrideConfigurer();
		beanFactoryPostProcessor.setBeanNameSeparator("@");
		beanFactoryPostProcessor.setProperties(props);
		ac.addBeanFactoryPostProcessor(beanFactoryPostProcessor);
	}

	// we could take the kernel bootstrap from from the classpath in future
	// rather than from
	// the filesystem

	List<Resource> config = new ArrayList<Resource>();
	String[] configPath = configPaths.split(";");
	for ( String p : configPath) {
		File xml = new File(p);
		config.add(new FileSystemResource(xml.getCanonicalPath()));
	}
	loadComponent(ac, config, classLoader);
	
	ac.refresh();

	// SAK-20908 - band-aid for TLM sync issues causing tests to fail
	// This sleep shouldn't be needed but it seems these tests are starting before ThreadLocalManager has finished its startup.
       try {
           Thread.sleep(500); // 1/2 second
           log.debug("Finished starting the component manager");
       } catch (InterruptedException e) {
           log.error("Component manager startup interrupted...");
       }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:64,代码来源:TestComponentManagerContainer.java

示例9: getBeanClass

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
@Override
protected Class getBeanClass(Element element) {
	return PropertyOverrideConfigurer.class;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:5,代码来源:PropertyOverrideBeanDefinitionParser.java

示例10: onSetUpInTransactionIfEnabled

import org.springframework.beans.factory.config.PropertyOverrideConfigurer; //导入依赖的package包/类
@Before
public void onSetUpInTransactionIfEnabled() throws Exception {
    m_fileAnticipator = new FileAnticipator();

    String filename = m_fileAnticipator.expecting("remote-poller.configuration").getCanonicalPath();
    filename = filename.replace("+", "%2B");
    System.setProperty("opennms.poller.configuration.resource", "file://" + filename);

    m_populator.populateDatabase();

    /**
     * We complete and end the transaction here so that the populated
     * database gets committed.  If we don't do this, the poller back
     * end (setup with the contexts in getConfigLocations) won't see
     * the populated database because it's working in another
     * transaction.  This will cause one of the asserts in testRegister
     * to fail because no services will be monitored by the remote
     * poller.
     */
    /*
    setComplete();
    endTransaction();
     */

    m_frontEndContext = new ClassPathXmlApplicationContext(
                                                           new String[] { 
                                                                   "classpath:/META-INF/opennms/applicationContext-remotePollerBackEnd-rmi.xml",
                                                                   "classpath:/META-INF/opennms/applicationContext-pollerFrontEnd.xml",
                                                           },
                                                           false
    );

    Properties props = new Properties();
    props.setProperty("configCheckTrigger.repeatInterval", "1000");

    PropertyOverrideConfigurer testPropertyConfigurer = new PropertyOverrideConfigurer();
    testPropertyConfigurer.setProperties(props);
    m_frontEndContext.addBeanFactoryPostProcessor(testPropertyConfigurer);

    m_frontEndContext.refresh();
    m_frontEnd = (PollerFrontEnd)m_frontEndContext.getBean("pollerFrontEnd");
    m_settings = (PollerSettings)m_frontEndContext.getBean("pollerSettings");
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:44,代码来源:PollerFrontEndIntegrationTest.java


注:本文中的org.springframework.beans.factory.config.PropertyOverrideConfigurer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。