當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。