本文整理汇总了Java中org.springframework.beans.factory.config.PlaceholderConfigurerSupport类的典型用法代码示例。如果您正苦于以下问题:Java PlaceholderConfigurerSupport类的具体用法?Java PlaceholderConfigurerSupport怎么用?Java PlaceholderConfigurerSupport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlaceholderConfigurerSupport类属于org.springframework.beans.factory.config包,在下文中一共展示了PlaceholderConfigurerSupport类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertyPlaceholder
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Test
public void propertyPlaceholder() throws Exception {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"contextNamespaceHandlerTests-replace.xml", getClass());
Map<String, PlaceholderConfigurerSupport> beans = applicationContext
.getBeansOfType(PlaceholderConfigurerSupport.class);
assertFalse("No PropertyPlaceholderConfigurer found", beans.isEmpty());
assertEquals("bar", applicationContext.getBean("string"));
assertEquals("null", applicationContext.getBean("nullString"));
}
示例2: propertyPlaceholderEnvironmentProperties
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Test
public void propertyPlaceholderEnvironmentProperties() throws Exception {
MockEnvironment env = new MockEnvironment().withProperty("foo", "spam");
GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext();
applicationContext.setEnvironment(env);
applicationContext.load(new ClassPathResource("contextNamespaceHandlerTests-simple.xml", getClass()));
applicationContext.refresh();
Map<String, PlaceholderConfigurerSupport> beans = applicationContext
.getBeansOfType(PlaceholderConfigurerSupport.class);
assertFalse("No PropertyPlaceholderConfigurer found", beans.isEmpty());
assertEquals("spam", applicationContext.getBean("string"));
assertEquals("none", applicationContext.getBean("fallback"));
}
示例3: propertyPlaceholderIgnored
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Test
public void propertyPlaceholderIgnored() throws Exception {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"contextNamespaceHandlerTests-replace-ignore.xml", getClass());
Map<String, PlaceholderConfigurerSupport> beans = applicationContext
.getBeansOfType(PlaceholderConfigurerSupport.class);
assertFalse("No PropertyPlaceholderConfigurer found", beans.isEmpty());
assertEquals("${bar}", applicationContext.getBean("string"));
assertEquals("null", applicationContext.getBean("nullString"));
}
示例4: resolvePlaceholders
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
public String resolvePlaceholders(String str, boolean asPropName) {
if (asPropName) {
String strResolving = PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_PREFIX + str + PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_SUFFIX,
strResolved = this.beanFactory.resolveEmbeddedValue(strResolving);
if (!strResolved.equals(strResolving)) {
str = strResolved;
}
} else {
str = this.beanFactory.resolveEmbeddedValue(str);
}
return Objects.toString(this.beanExprResolver.evaluate(str, this.beanExprContext), null);
}
示例5: propertyPlaceholder
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Test
public void propertyPlaceholder() throws Exception {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"contextNamespaceHandlerTests-replace.xml", getClass());
Map<String, PlaceholderConfigurerSupport> beans = applicationContext
.getBeansOfType(PlaceholderConfigurerSupport.class);
assertFalse("No PropertyPlaceholderConfigurer found", beans.isEmpty());
String s = (String) applicationContext.getBean("string");
assertEquals("No properties replaced", "bar", s);
}
示例6: propertyPlaceholderEnvironmentProperties
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Test
public void propertyPlaceholderEnvironmentProperties() throws Exception {
MockEnvironment env = new MockEnvironment().withProperty("foo", "spam");
GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext();
applicationContext.setEnvironment(env);
applicationContext.load(new ClassPathResource("contextNamespaceHandlerTests-simple.xml", getClass()));
applicationContext.refresh();
Map<String, PlaceholderConfigurerSupport> beans = applicationContext
.getBeansOfType(PlaceholderConfigurerSupport.class);
assertFalse("No PropertyPlaceholderConfigurer found", beans.isEmpty());
String s = (String) applicationContext.getBean("string");
assertEquals("No properties replaced", "spam", s);
}
示例7: propertyPlaceholderIgnored
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Test
public void propertyPlaceholderIgnored() throws Exception {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"contextNamespaceHandlerTests-replace-ignore.xml", getClass());
Map<String, PlaceholderConfigurerSupport> beans = applicationContext
.getBeansOfType(PlaceholderConfigurerSupport.class);
assertFalse("No PropertyPlaceholderConfigurer found", beans.isEmpty());
String s = (String) applicationContext.getBean("string");
assertEquals("Properties replaced", "${bar}", s);
}
示例8: FrameworkBeanFactory
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
/**
* Creates a bean factory.
*
* @param parentContext Parent application context, if any. When specified, any placeholder
* configurers found in the parent context will be registered in this bean factory.
* @param parentBeanFactory The parent bean factory, if any.
*/
public FrameworkBeanFactory(ApplicationContext parentContext, BeanFactory parentBeanFactory) {
super(parentBeanFactory);
int i = 0;
if (parentContext != null) {
for (PlaceholderConfigurerSupport configurer : parentContext
.getBeansOfType(PlaceholderConfigurerSupport.class, false, false).values()) {
registerSingleton("_placeholderconfigurer" + ++i, configurer);
}
}
}
示例9: SpringPropertyReplacer
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
/**
* Default constructor
*/
public SpringPropertyReplacer() {
phHelper = new PropertyPlaceholderHelper(
PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_PREFIX,
PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_SUFFIX,
PlaceholderConfigurerSupport.DEFAULT_VALUE_SEPARATOR, true);
}
示例10: matches
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Override
public boolean matches(
final ConditionContext context, final AnnotatedTypeMetadata metadata
) {
return context.getBeanFactory().getBeansOfType(PlaceholderConfigurerSupport.class).isEmpty();
}
示例11: placeholderConfigurer
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Bean
public static PlaceholderConfigurerSupport placeholderConfigurer() {
return new ConfigurationPropertySourcesPlaceholderConfigurer(StaticConfigurationSupplier.getConfiguration());
}
示例12: initializeHelper
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
protected void initializeHelper() {
helper = new PropertyPlaceholderHelper(PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_PREFIX,
PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_SUFFIX,
PlaceholderConfigurerSupport.DEFAULT_VALUE_SEPARATOR, true);
}
示例13: propertyPlaceholderConfigurer
import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; //导入依赖的package包/类
@Bean
public static PlaceholderConfigurerSupport propertyPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}