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


Java PropertyPlaceholderConfigurer.setLocation方法代码示例

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


在下文中一共展示了PropertyPlaceholderConfigurer.setLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPropertyPlaceholderConfigurer

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
/**
 * Gets the property placeholder configurer.
 *
 * @return the property placeholder configurer
 */
@Bean(name = "propertyPlaceholderConfigurer")
public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer() {
  logger.debug("Instantiated propertyPlaceholderConfigurer");
  PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
  configurer.setLocation(new ClassPathResource("stats.properties"));
  configurer.setNullValue("NULL");

  Properties properties = new Properties();
  properties.put("psiprobe.tools.mail.to", "NULL");
  properties.put("psiprobe.tools.mail.subjectPrefix", "[PSI Probe]");
  configurer.setProperties(properties);

  configurer.setSystemPropertiesModeName("SYSTEM_PROPERTIES_MODE_OVERRIDE");

  return configurer;
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:22,代码来源:ProbeConfig.java

示例2: propertyPlaceholderConfigurer

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {

  final PropertyPlaceholderConfigurer propConfig =
      new PropertyPlaceholderConfigurer();

  propConfig.setIgnoreResourceNotFound(true);
  String sysPropPath = System.getProperty("app.cfg");

  if (sysPropPath != null) {
    propConfig.setLocation(new FileSystemResource(sysPropPath));
  } else {
    propConfig.setLocation(new ClassPathResource(APP_PROPERTIES));
  }
  return propConfig;
}
 
开发者ID:rebx,项目名称:spring4-mvc-noxml,代码行数:17,代码来源:AppConfig.java

示例3: GlobalModelExchangeImpl

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
public GlobalModelExchangeImpl() throws RemoteException {
    super();
    try {
        String gmeConfigurationFile = getConfiguration().getGmeConfigurationFile();
        String gmeProperties = getConfiguration().getGmePropertiesFile();
        FileSystemResource gmeConfResource = new FileSystemResource(gmeConfigurationFile);
        FileSystemResource gmePropertiesResource = new FileSystemResource(gmeProperties);

        XmlBeanFactory factory = new XmlBeanFactory(gmeConfResource);
        PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
        cfg.setLocation(gmePropertiesResource);
        cfg.postProcessBeanFactory(factory);

        this.gme = (GME) factory.getBean(GME_BEAN_NAME, GME.class);

    } catch (Exception e) {
        String message = "Problem inititializing GME while loading configuration:" + e.getMessage();
        LOG.error(message, e);
        throw new RemoteException(message, e);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:22,代码来源:GlobalModelExchangeImpl.java

示例4: IdentifiersNAServiceImpl

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
public IdentifiersNAServiceImpl() throws RemoteException {
    super();

    try {
        String naConfigurationFile = getConfiguration().getNaConfigurationFile();
        String naProperties = getConfiguration().getNaPropertiesFile();
        FileSystemResource naConfResource = new FileSystemResource(naConfigurationFile);
        FileSystemResource naPropertiesResource = new FileSystemResource(naProperties);

        XmlBeanFactory factory = new XmlBeanFactory(naConfResource);
        PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
        cfg.setLocation(naPropertiesResource);
        cfg.postProcessBeanFactory(factory);

        this.namingAuthority = (MaintainerNamingAuthority) factory.getBean(NA_BEAN_NAME, MaintainerNamingAuthority.class);

    } catch (Exception e) {
        String message = "Problem inititializing NamingAuthority while loading configuration:" + e.getMessage();
        LOG.error(message, e);
        throw new RemoteException(message, e);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:23,代码来源:IdentifiersNAServiceImpl.java

示例5: initialize

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Override
public void initialize(AbstractApplicationContext applicationContext) {
    PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
    //load test.properties
    propertyPlaceholderConfigurer.setLocation(new ClassPathResource("test.properties"));

    applicationContext.addBeanFactoryPostProcessor(propertyPlaceholderConfigurer);
}
 
开发者ID:monkeyk,项目名称:MyOIDC,代码行数:9,代码来源:TestApplicationContextInitializer.java

示例6: propertyConfig

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public PropertyPlaceholderConfigurer propertyConfig() {
    PropertyPlaceholderConfigurer placeholderConfigurer = new PropertyPlaceholderConfigurer();
    placeholderConfigurer.setLocation(new ClassPathResource("application-test.properties"));
    placeholderConfigurer.setIgnoreResourceNotFound(true);
    return placeholderConfigurer;
}
 
开发者ID:sdl,项目名称:ecommerce-framework,代码行数:8,代码来源:TestContext.java

示例7: iocStart

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的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

示例8: createApplicationContext

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
/**
 * Creates the application context.
 * 
 * @param repo  the component repository, not null
 * @return the Spring application context, not null
 */
protected GenericApplicationContext createApplicationContext(ComponentRepository repo) {
  Resource springFile = getSpringFile();
  try {
    repo.getLogger().logDebug("  Spring file: " + springFile.getURI());
  } catch (Exception ex) {
    // ignore
  }
  
  DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
  GenericApplicationContext appContext = new GenericApplicationContext(beanFactory);
  
  PropertyPlaceholderConfigurer properties = new PropertyPlaceholderConfigurer();
  properties.setLocation(getPropertiesFile());
  
  XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);
  beanDefinitionReader.setValidating(true);
  beanDefinitionReader.setResourceLoader(appContext);
  beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(appContext));
  beanDefinitionReader.loadBeanDefinitions(springFile);
  
  appContext.getBeanFactory().registerSingleton("injectedProperties", properties);
  appContext.getBeanFactory().registerSingleton("componentRepository", repo);
  
  appContext.refresh();
  return appContext;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:33,代码来源:AbstractSpringComponentFactory.java

示例9: propConfig

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertyPlaceholderConfigurer propConfig() {
  System.out.println("PropertyPlaceholderConfigurer configured!");
  PropertyPlaceholderConfigurer ppc =  new PropertyPlaceholderConfigurer();
  ppc.setLocation(new ClassPathResource("/app.properties"));

  return ppc;
}
 
开发者ID:tunguski,项目名称:kosher,代码行数:9,代码来源:AppConfig.java

示例10: propConfig

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertyPlaceholderConfigurer propConfig() {
    Properties properties = new Properties();
    properties.put("alfio.version", "1.9-SNAPSHOT");
    properties.put("alfio.build-ts", ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1).toString());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(out);
    properties.list(pw);
    pw.flush();
    PropertyPlaceholderConfigurer ppc =  new PropertyPlaceholderConfigurer();
    ppc.setLocation(new ByteArrayResource(out.toByteArray()));
    return ppc;
}
 
开发者ID:alfio-event,项目名称:alf.io,代码行数:14,代码来源:TestConfiguration.java

示例11: getPropertyPlaceholderConfigurer

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer()
{
    PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
    ppc.setLocation(new FileSystemResource(System.getProperty("catalina.base") + "/conf/awsi.properties"));
    ppc.setIgnoreUnresolvablePlaceholders(false);
    return ppc;
}
 
开发者ID:david-ciamberlano,项目名称:website-inventor,代码行数:9,代码来源:AppConfiguration.java

示例12: BeanUtils

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
public BeanUtils(AbstractResource conf,
		AbstractResource properties) throws Exception {
	this.factory = new XmlBeanFactory(conf);
	PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
	cfg.setLocation(properties);
	cfg.postProcessBeanFactory(factory);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:8,代码来源:BeanUtils.java

示例13: placeHolderProperties

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public PropertyPlaceholderConfigurer placeHolderProperties() throws Exception {

	log.info("create PropertyPlaceholderConfigurer");
	PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
	configurer.setLocation(new ClassPathResource("batch.properties"));
	configurer.setSystemPropertiesModeName("SYSTEM_PROPERTIES_MODE_OVERRIDE");
	configurer.setIgnoreUnresolvablePlaceholders(true);
	configurer.setOrder(1);

	return configurer;
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:13,代码来源:LaunchConfiguration.java

示例14: placeHolderProperties

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public PropertyPlaceholderConfigurer placeHolderProperties() throws Exception {

    LaunchConfiguration.log.info("create PropertyPlaceholderConfigurer");
    PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
    configurer.setLocation(new ClassPathResource("batch.properties"));
    configurer.setSystemPropertiesModeName("SYSTEM_PROPERTIES_MODE_OVERRIDE");
    configurer.setIgnoreUnresolvablePlaceholders(true);
    configurer.setOrder(1);

    return configurer;
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:13,代码来源:LaunchConfiguration.java

示例15: loadConfiguration

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; //导入方法依赖的package包/类
public static XmlBeanFactory loadConfiguration() throws Exception {

		ClassPathResource cpr = new ClassPathResource(
				Constants.CDS_CONFIGURATION);
		XmlBeanFactory factory = new XmlBeanFactory(cpr);
		PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
		cfg.setLocation(new ClassPathResource(Constants.CDS_PROPERTIES));
		cfg.postProcessBeanFactory(factory);
		return factory;
	}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:11,代码来源:Utils.java


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