use of org.springframework.beans.factory.wiring.BeanWiringInfo in project spring-framework by spring-projects.
the class AnnotationBeanWiringInfoResolverTests method testResolveWiringInfoWithAnInstanceOfANonAnnotatedClass.
@Test
public void testResolveWiringInfoWithAnInstanceOfANonAnnotatedClass() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo("java.lang.String is not @Configurable");
assertNull("Must be returning null for a non-@Configurable class instance", info);
}
use of org.springframework.beans.factory.wiring.BeanWiringInfo in project spring-framework by spring-projects.
the class AnnotationBeanWiringInfoResolverTests method testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitlyAndCustomBeanName.
@Test
public void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitlyAndCustomBeanName() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new NamedWirelessSoap());
assertNotNull("Must *not* be returning null for an @Configurable class instance even when autowiring is NO", info);
assertFalse(info.indicatesAutowiring());
assertEquals("DerBigStick", info.getBeanName());
}
use of org.springframework.beans.factory.wiring.BeanWiringInfo in project cxf by apache.
the class ConfigurerImpl method configureBean.
public synchronized void configureBean(String bn, Object beanInstance, boolean checkWildcards) {
if (null == appContexts) {
return;
}
if (null == bn) {
bn = getBeanName(beanInstance);
}
if (null == bn) {
return;
}
if (checkWildcards) {
configureWithWildCard(bn, beanInstance);
}
final String beanName = bn;
setBeanWiringInfoResolver(new BeanWiringInfoResolver() {
public BeanWiringInfo resolveWiringInfo(Object instance) {
if (!"".equals(beanName)) {
return new BeanWiringInfo(beanName);
}
return null;
}
});
for (ApplicationContext appContext : appContexts) {
if (appContext.containsBean(bn)) {
this.setBeanFactory(appContext.getAutowireCapableBeanFactory());
}
}
try {
// this can leak memory
if (beanFactory instanceof AbstractBeanFactory) {
((AbstractBeanFactory) beanFactory).getMergedBeanDefinition(bn);
}
super.configureBean(beanInstance);
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Successfully performed injection.");
}
} catch (NoSuchBeanDefinitionException ex) {
// incorrect bean ids
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "NO_MATCHING_BEAN_MSG", beanName);
}
}
}
use of org.springframework.beans.factory.wiring.BeanWiringInfo in project spring-framework by spring-projects.
the class AnnotationBeanWiringInfoResolverTests method testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitly.
@Test
public void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitly() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new WirelessSoap());
assertNotNull("Must *not* be returning null for an @Configurable class instance even when autowiring is NO", info);
assertFalse(info.indicatesAutowiring());
assertEquals(WirelessSoap.class.getName(), info.getBeanName());
}
use of org.springframework.beans.factory.wiring.BeanWiringInfo in project spring-framework by spring-projects.
the class AnnotationBeanWiringInfoResolverTests method testResolveWiringInfoWithAnInstanceOfAnAnnotatedClass.
@Test
public void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClass() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new Soap());
assertNotNull("Must *not* be returning null for a non-@Configurable class instance", info);
}
Aggregations