if (!isExcluded(beanName) && !isBeanDefinitionAbstract(this.beanFactory, beanName)) { try { Class<?> beanClass = this.beanFactory.getType(beanName); if (beanClass != null && callback.include(beanClass, beanName)) { boolean lazyInit = isBeanDefinitionLazyInit(this.beanFactory, beanName);
Class<?> type = this.beanFactory.getType(beanName); if (type != null && !type.isInterface()) { WebService wsAnnotation = type.getAnnotation(WebService.class);
Class<?> beanType = this.beanFactory.getType(beanName); if (beanType == null) { continue;
if (!isExcluded(beanName) && !isBeanDefinitionAbstract(this.beanFactory, beanName)) { try { Class<?> beanClass = this.beanFactory.getType(beanName); if (beanClass != null && callback.include(beanClass, beanName)) { boolean lazyInit = isBeanDefinitionLazyInit(this.beanFactory, beanName);
Class<?> type = this.beanFactory.getType(beanName); if (type != null && !type.isInterface()) { WebService wsAnnotation = type.getAnnotation(WebService.class);
proxyFactory.setFrozen(true); if (isMBean(this.beanFactory.getType(beanName))) {
proxyFactory.setFrozen(true); if (isMBean(this.beanFactory.getType(beanName))) {
@Test public void configWithFactoryBeanReturnType() { ListableBeanFactory factory = initBeanFactory(ConfigWithNonSpecificReturnTypes.class); assertEquals(List.class, factory.getType("factoryBean")); assertTrue(factory.isTypeMatch("factoryBean", List.class)); assertEquals(FactoryBean.class, factory.getType("&factoryBean")); assertTrue(factory.isTypeMatch("&factoryBean", FactoryBean.class)); assertFalse(factory.isTypeMatch("&factoryBean", BeanClassLoaderAware.class)); assertFalse(factory.isTypeMatch("&factoryBean", ListFactoryBean.class)); assertTrue(factory.getBean("factoryBean") instanceof List); String[] beanNames = factory.getBeanNamesForType(FactoryBean.class); assertEquals(1, beanNames.length); assertEquals("&factoryBean", beanNames[0]); beanNames = factory.getBeanNamesForType(BeanClassLoaderAware.class); assertEquals(1, beanNames.length); assertEquals("&factoryBean", beanNames[0]); beanNames = factory.getBeanNamesForType(ListFactoryBean.class); assertEquals(1, beanNames.length); assertEquals("&factoryBean", beanNames[0]); beanNames = factory.getBeanNamesForType(List.class); assertEquals("factoryBean", beanNames[0]); }
private Collection<Object> getBeansOfTypeExcept(Class<?> type, Collection<Class<?>> exceptions) { List<Object> result = new ArrayList<Object>(); for (String beanName : context.getBeanNamesForType(type, false, eagerInit)) { if (exceptions.contains(context.getType(beanName))) { continue; } result.add(context.getBean(beanName)); } return result; } }
/** * Binds all Spring beans from the given factory by name. For a Spring bean named "foo", this * method creates a binding to the bean's type and {@code @Named("foo")}. * * @see com.google.inject.name.Named * @see com.google.inject.name.Names#named(String) */ public static void bindAll(Binder binder, ListableBeanFactory beanFactory) { binder = binder.skipSources(SpringIntegration.class); for (String name : beanFactory.getBeanDefinitionNames()) { Class<?> type = beanFactory.getType(name); bindBean(binder, beanFactory, name, type); } }
/** * Dumps the application elements along with their actual types. * * @param args main arguments */ public static void main(String... args) { ListableBeanFactory applicationContext = new ClassPathXmlApplicationContext( "/org/jspresso/framework/application/commons.xml", "/org/jspresso/framework/application/backend/persistence/hibernate/commons-hibernate.xml", "/org/jspresso/framework/application/frontend/commons-frontend.xml", "/org/jspresso/framework/application/mock-config.xml"); String[] beanNames = applicationContext.getBeanDefinitionNames(); Arrays.sort(beanNames, String.CASE_INSENSITIVE_ORDER); for (String beanName : beanNames) { Class<?> beanType = applicationContext.getType(beanName); outputLine(beanName, beanType); String[] aliases = applicationContext.getAliases(beanName); if (aliases != null) { for (String alias : aliases) { outputLine(alias, beanType); } } } }
private Map<String, JobFactory> loadFactories(ListableBeanFactory beanFactory) { ImmutableMap.Builder<String, JobFactory> mb = ImmutableMap.builder(); //load factory beans String[] factoryNames = beanFactory.getBeanNamesForType(JobFactory.class); for(String factoryName: factoryNames) { JobFactory factory = beanFactory.getBean(factoryName, JobFactory.class); if(factory == this) { // we do not want to load self continue; } Set<String> types = factory.getTypes(); for(String type: types) { mb.put(type, factory); } } //load job beans String[] jobNames = beanFactory.getBeanNamesForAnnotation(JobBean.class); for(String jobName: jobNames) { Class<?> jobType = beanFactory.getType(jobName); JobDescription jd = descFactory.getFor(jobName); mb.put(jobName, new JobFactoryForBean(this, jobName, jobType, jd)); } return mb.build(); }
if (!isExcluded(beanName) && !isBeanDefinitionAbstract(this.beanFactory, beanName)) { try { Class<?> beanClass = this.beanFactory.getType(beanName); if (beanClass != null && callback.include(beanClass, beanName)) { boolean lazyInit = isBeanDefinitionLazyInit(this.beanFactory, beanName);
Class<?> type = this.beanFactory.getType(beanName); if (type != null && !type.isInterface()) { WebService wsAnnotation = type.getAnnotation(WebService.class);
Class<?> type = this.beanFactory.getType(beanName); if (type != null && !type.isInterface()) { WebService wsAnnotation = type.getAnnotation(WebService.class);
Class<?> beanType = this.beanFactory.getType(beanName); if (beanType == null) { continue;
Class<?> beanType = this.beanFactory.getType(beanName); if (beanType == null) { continue;
proxyFactory.setFrozen(true); if (isMBean(this.beanFactory.getType(beanName))) {