本文整理了Java中org.springframework.context.ApplicationContext.containsBeanDefinition()
方法的一些代码示例,展示了ApplicationContext.containsBeanDefinition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationContext.containsBeanDefinition()
方法的具体详情如下:
包路径:org.springframework.context.ApplicationContext
类名称:ApplicationContext
方法名:containsBeanDefinition
暂无
代码示例来源:origin: spring-projects/spring-security
UserDetailsService cachingUserDetailsService(String id) {
if (!StringUtils.hasText(id)) {
return getUserDetailsService();
}
// Overwrite with the caching version if available
String cachingId = id
+ AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX;
if (beanFactory.containsBeanDefinition(cachingId)) {
return (UserDetailsService) beanFactory.getBean(cachingId);
}
return (UserDetailsService) beanFactory.getBean(id);
}
代码示例来源:origin: spring-projects/spring-security
private CorsFilter getCorsFilter(ApplicationContext context) {
if (this.configurationSource != null) {
return new CorsFilter(this.configurationSource);
}
boolean containsCorsFilter = context
.containsBeanDefinition(CORS_FILTER_BEAN_NAME);
if (containsCorsFilter) {
return context.getBean(CORS_FILTER_BEAN_NAME, CorsFilter.class);
}
boolean containsCorsSource = context
.containsBean(CORS_CONFIGURATION_SOURCE_BEAN_NAME);
if (containsCorsSource) {
CorsConfigurationSource configurationSource = context.getBean(
CORS_CONFIGURATION_SOURCE_BEAN_NAME, CorsConfigurationSource.class);
return new CorsFilter(configurationSource);
}
boolean mvcPresent = ClassUtils.isPresent(HANDLER_MAPPING_INTROSPECTOR,
context.getClassLoader());
if (mvcPresent) {
return MvcCorsFilter.getMvcCorsFilter(context);
}
return null;
}
代码示例来源:origin: spring-projects/spring-batch
/**
* Check the resulting credits correspond to inputs increased by fixed
* amount.
*/
@Test
public void testUpdateCredit() throws Exception {
assertTrue("Define a prototype bean called 'outputTestReader' to check the output", applicationContext
.containsBeanDefinition("outputTestReader"));
open(inputReader);
List<CustomerCredit> inputs = new ArrayList<>(getCredits(inputReader));
close(inputReader);
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
@SuppressWarnings("unchecked")
ItemReader<CustomerCredit> outputReader = (ItemReader<CustomerCredit>) applicationContext
.getBean("outputTestReader");
open(outputReader);
List<CustomerCredit> outputs = new ArrayList<>(getCredits(outputReader));
close(outputReader);
assertEquals(inputs.size(), outputs.size());
int itemCount = inputs.size();
assertTrue(itemCount > 0);
inputs.iterator();
for (int i = 0; i < itemCount; i++) {
assertEquals(inputs.get(i).getCredit().add(CustomerCreditIncreaseProcessor.FIXED_AMOUNT).intValue(),
outputs.get(i).getCredit().intValue());
}
}
代码示例来源:origin: spring-projects/spring-batch
/**
* Check the resulting credits correspond to inputs increased by fixed
* amount.
*/
@Test
public void testUpdateCredit() throws Exception {
assertTrue("Define a prototype bean called 'outputTestReader' to check the output", applicationContext
.containsBeanDefinition("outputTestReader"));
open(inputReader);
List<CustomerCredit> inputs = new ArrayList<>(getCredits(inputReader));
close(inputReader);
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
@SuppressWarnings("unchecked")
ItemReader<CustomerCredit> outputReader = (ItemReader<CustomerCredit>) applicationContext
.getBean("outputTestReader");
open(outputReader);
List<CustomerCredit> outputs = new ArrayList<>(getCredits(outputReader));
close(outputReader);
assertEquals(inputs.size(), outputs.size());
int itemCount = inputs.size();
assertTrue(itemCount > 0);
inputs.iterator();
for (int i = 0; i < itemCount; i++) {
assertEquals(inputs.get(i).getCredit().add(CustomerCreditIncreaseProcessor.FIXED_AMOUNT).intValue(),
outputs.get(i).getCredit().intValue());
}
}
代码示例来源:origin: org.springframework.security/spring-security-config
UserDetailsService cachingUserDetailsService(String id) {
if (!StringUtils.hasText(id)) {
return getUserDetailsService();
}
// Overwrite with the caching version if available
String cachingId = id
+ AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX;
if (beanFactory.containsBeanDefinition(cachingId)) {
return (UserDetailsService) beanFactory.getBean(cachingId);
}
return (UserDetailsService) beanFactory.getBean(id);
}
代码示例来源:origin: org.springframework.security/spring-security-config
private CorsFilter getCorsFilter(ApplicationContext context) {
if (this.configurationSource != null) {
return new CorsFilter(this.configurationSource);
}
boolean containsCorsFilter = context
.containsBeanDefinition(CORS_FILTER_BEAN_NAME);
if (containsCorsFilter) {
return context.getBean(CORS_FILTER_BEAN_NAME, CorsFilter.class);
}
boolean containsCorsSource = context
.containsBean(CORS_CONFIGURATION_SOURCE_BEAN_NAME);
if (containsCorsSource) {
CorsConfigurationSource configurationSource = context.getBean(
CORS_CONFIGURATION_SOURCE_BEAN_NAME, CorsConfigurationSource.class);
return new CorsFilter(configurationSource);
}
boolean mvcPresent = ClassUtils.isPresent(HANDLER_MAPPING_INTROSPECTOR,
context.getClassLoader());
if (mvcPresent) {
return MvcCorsFilter.getMvcCorsFilter(context);
}
return null;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-common
/**
* @param arg0
* @return
* @see org.springframework.beans.factory.ListableBeanFactory#containsBeanDefinition(java.lang.String)
*/
public boolean containsBeanDefinition(String arg0) {
return target.containsBeanDefinition(arg0);
}
代码示例来源:origin: net.sf.taverna.t2.infrastructure/platform-spring
/**
* Delegates to internal ApplicationContext supplied by constructor
*/
public final boolean containsBeanDefinition(String arg0) {
return context.containsBeanDefinition(arg0);
}
代码示例来源:origin: com.consol.citrus/citrus-ws
public boolean containsBeanDefinition(String beanName) {
return applicationContext.containsBeanDefinition(beanName);
}
public long getStartupDate() {
代码示例来源:origin: unic/neba
@Override
public boolean containsBeanDefinition(String beanName) {
return wrapped.containsBeanDefinition(beanName);
}
代码示例来源:origin: org.kuali.student.core/ks-common-util
@Override
public boolean containsBeanDefinition(String beanName) {
return applicationContext.containsBeanDefinition(beanName);
}
代码示例来源:origin: org.kuali.student.common/ks-common-util
public boolean containsBeanDefinition(String beanName) {
return applicationContext.containsBeanDefinition(beanName);
}
代码示例来源:origin: net.javacrumbs/smock-http
public boolean containsBeanDefinition(String beanName) {
return wrappedApplicationContext.containsBeanDefinition(beanName);
}
代码示例来源:origin: com.github.drtrang/spring-boot-autoconfigure
public static boolean containsBeanDefinition(String beanName) {
return context.containsBeanDefinition(beanName);
}
代码示例来源:origin: net.sf.taverna.t2.infrastructure/platform-spring
public final void setApplicationContext(ApplicationContext context)
throws BeansException {
this.applicationContext = context;
if (context.containsBeanDefinition("platform.propertyPlaceholder")) {
try {
propHolder = (RavenAwarePropertyPlaceholderConfigurer) context
.getBean("platform.propertyPlaceholder");
} catch (ClassCastException cce) {
//
}
}
}
代码示例来源:origin: org.springframework.security/org.springframework.security.config
UserDetailsService cachingUserDetailsService(String id) {
if (!StringUtils.hasText(id)) {
return getUserDetailsService();
}
// Overwrite with the caching version if available
String cachingId = id + AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX;
if (beanFactory.containsBeanDefinition(cachingId)) {
return (UserDetailsService) beanFactory.getBean(cachingId);
}
return (UserDetailsService) beanFactory.getBean(id);
}
代码示例来源:origin: apache/archiva
@Override
public boolean containsBeanDefinition( String s )
{
return applicationContext.containsBeanDefinition( s );
}
代码示例来源:origin: apache/servicemix-bundles
UserDetailsService cachingUserDetailsService(String id) {
if (!StringUtils.hasText(id)) {
return getUserDetailsService();
}
// Overwrite with the caching version if available
String cachingId = id
+ AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX;
if (beanFactory.containsBeanDefinition(cachingId)) {
return (UserDetailsService) beanFactory.getBean(cachingId);
}
return (UserDetailsService) beanFactory.getBean(id);
}
代码示例来源:origin: fcrepo3/fcrepo
protected boolean knownBeanDefinition(String beanName) {
return m_moduleContext.containsBeanDefinition(beanName)
|| m_moduleContext.getParent().containsBeanDefinition(beanName);
}
代码示例来源:origin: org.fcrepo/fcrepo-server
protected boolean knownBeanDefinition(String beanName) {
return m_moduleContext.containsBeanDefinition(beanName)
|| m_moduleContext.getParent().containsBeanDefinition(beanName);
}
内容来源于网络,如有侵权,请联系作者删除!