本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}