private String[] getInterfaces(PropertyValue pv) { if (pv == null) return new String[0]; Object value = pv.getValue(); if (value instanceof Collection) { Collection collection = (Collection) value; String[] strs = new String[collection.size()]; int index = 0; for (Object obj : collection) { if (value instanceof TypedStringValue) { strs[index] = ((TypedStringValue) value).getValue(); } else { strs[index] = value.toString(); } index++; } return strs; } else { return new String[] { value.toString() }; } }
static List<BeanProperty> getBeanProperties(BeanDefinition definition) { List<BeanProperty> temp; List<PropertyValue> pvs = definition.getPropertyValues().getPropertyValueList(); if (pvs.isEmpty()) { return Collections.<BeanProperty> emptyList(); } else { temp = new ArrayList<BeanProperty>(pvs.size()); } for (PropertyValue propertyValue : pvs) { temp.add(new SimpleBeanProperty(propertyValue)); } return Collections.unmodifiableList(temp); }
private void parsePropertyElement(Element ele, BeanDefinition bd) { String propertyName = ele.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE); if (!StringUtils.hasLength(propertyName)) { error("Tag 'property' must have a 'name' attribute", ele); return; } this.parseState.push(new PropertyEntry(propertyName)); try { if (bd.getPropertyValues().contains(propertyName)) { error("Multiple 'property' definitions for property '" + propertyName + "'", ele); return; } Object val = parsePropertyValue(ele, bd, propertyName); PropertyValue pv = new PropertyValue(propertyName, val); pv.setSource(parserContext.extractSource(ele)); bd.getPropertyValues().addPropertyValue(pv); } finally { this.parseState.pop(); } }
/** * Check the given property values for field defaults, * i.e. for fields that start with the field default prefix. * <p>The existence of a field defaults indicates that the specified * value should be used if the field is otherwise not present. * @param mpvs the property values to be bound (can be modified) * @see #getFieldDefaultPrefix */ protected void checkFieldDefaults(MutablePropertyValues mpvs) { if (getFieldDefaultPrefix() != null) { String fieldDefaultPrefix = getFieldDefaultPrefix(); PropertyValue[] pvArray = mpvs.getPropertyValues(); for (PropertyValue pv : pvArray) { if (pv.getName().startsWith(fieldDefaultPrefix)) { String field = pv.getName().substring(fieldDefaultPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { mpvs.add(field, pv.getValue()); } mpvs.removePropertyValue(pv); } } } }
/** * Check the given property values for field markers, * i.e. for fields that start with the field marker prefix. * <p>The existence of a field marker indicates that the specified * field existed in the form. If the property values do not contain * a corresponding field value, the field will be considered as empty * and will be reset appropriately. * @param mpvs the property values to be bound (can be modified) * @see #getFieldMarkerPrefix * @see #getEmptyValue(String, Class) */ protected void checkFieldMarkers(MutablePropertyValues mpvs) { if (getFieldMarkerPrefix() != null) { String fieldMarkerPrefix = getFieldMarkerPrefix(); PropertyValue[] pvArray = mpvs.getPropertyValues(); for (PropertyValue pv : pvArray) { if (pv.getName().startsWith(fieldMarkerPrefix)) { String field = pv.getName().substring(fieldMarkerPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { Class<?> fieldType = getPropertyAccessor().getPropertyType(field); mpvs.add(field, getEmptyValue(field, fieldType)); } mpvs.removePropertyValue(pv); } } } }
/** * Create new FilterConfigPropertyValues. * @param config FilterConfig we'll use to take PropertyValues from * @param requiredProperties set of property names we need, where * we can't accept default values * @throws ServletException if any required properties are missing */ public FilterConfigPropertyValues(FilterConfig config, Set<String> requiredProperties) throws ServletException { Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ? new HashSet<String>(requiredProperties) : null; Enumeration<?> en = config.getInitParameterNames(); while (en.hasMoreElements()) { String property = (String) en.nextElement(); Object value = config.getInitParameter(property); addPropertyValue(new PropertyValue(property, value)); if (missingProps != null) { missingProps.remove(property); } } // Fail if we are still missing properties. if (missingProps != null && missingProps.size() > 0) { throw new ServletException( "Initialization from FilterConfig for filter '" + config.getFilterName() + "' failed; the following required properties were missing: " + StringUtils.collectionToDelimitedString(missingProps, ", ")); } }
/** * Parse a property element. */ public void parsePropertyElement(Element ele, BeanDefinition bd) { String propertyName = ele.getAttribute(NAME_ATTRIBUTE); if (!StringUtils.hasLength(propertyName)) { error("Tag 'property' must have a 'name' attribute", ele); return; } this.parseState.push(new PropertyEntry(propertyName)); try { if (bd.getPropertyValues().contains(propertyName)) { error("Multiple 'property' definitions for property '" + propertyName + "'", ele); return; } Object val = parsePropertyValue(ele, bd, propertyName); PropertyValue pv = new PropertyValue(propertyName, val); parseMetaElements(ele, pv); pv.setSource(extractSource(ele)); bd.getPropertyValues().addPropertyValue(pv); } finally { this.parseState.pop(); } }
private void findInnerBeanDefinitionsAndBeanReferences(BeanDefinition beanDefinition) { List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>(); List<BeanReference> references = new ArrayList<BeanReference>(); PropertyValues propertyValues = beanDefinition.getPropertyValues(); for (int i = 0; i < propertyValues.getPropertyValues().length; i++) { PropertyValue propertyValue = propertyValues.getPropertyValues()[i]; Object value = propertyValue.getValue(); if (value instanceof BeanDefinitionHolder) { innerBeans.add(((BeanDefinitionHolder) value).getBeanDefinition()); } else if (value instanceof BeanDefinition) { innerBeans.add((BeanDefinition) value); } else if (value instanceof BeanReference) { references.add((BeanReference) value); } } this.innerBeanDefinitions = innerBeans.toArray(new BeanDefinition[innerBeans.size()]); this.beanReferences = references.toArray(new BeanReference[references.size()]); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void postProcessBeanFactory( ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException { String[] igniteConfigNames = configurableListableBeanFactory.getBeanNamesForType(IgniteConfiguration.class); if (igniteConfigNames.length != 1) { throw new IllegalArgumentException("Spring config must contain exactly one ignite configuration!"); } String[] activeStoreConfigNames = configurableListableBeanFactory.getBeanNamesForType(BaseActiveStoreConfiguration.class); if (activeStoreConfigNames.length != 1) { throw new IllegalArgumentException("Spring config must contain exactly one active store configuration!"); } BeanDefinition igniteConfigDef = configurableListableBeanFactory.getBeanDefinition(igniteConfigNames[0]); MutablePropertyValues propertyValues = igniteConfigDef.getPropertyValues(); if (!propertyValues.contains(USER_ATTRS_PROP_NAME)) { propertyValues.add(USER_ATTRS_PROP_NAME, new ManagedMap()); } PropertyValue propertyValue = propertyValues.getPropertyValue(USER_ATTRS_PROP_NAME); Map userAttrs = (Map)propertyValue.getValue(); TypedStringValue key = new TypedStringValue(CONFIG_USER_ATTR); RuntimeBeanReference value = new RuntimeBeanReference(beanName); userAttrs.put(key, value); }
/** * Create new PortletConfigPropertyValues. * @param config PortletConfig we'll use to take PropertyValues from * @param requiredProperties set of property names we need, where * we can't accept default values * @throws PortletException if any required properties are missing */ private PortletConfigPropertyValues(PortletConfig config, Set<String> requiredProperties) throws PortletException { Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ? new HashSet<String>(requiredProperties) : null; Enumeration<String> en = config.getInitParameterNames(); while (en.hasMoreElements()) { String property = en.nextElement(); Object value = config.getInitParameter(property); addPropertyValue(new PropertyValue(property, value)); if (missingProps != null) { missingProps.remove(property); } } // fail if we are still missing properties if (missingProps != null && missingProps.size() > 0) { throw new PortletException( "Initialization from PortletConfig for portlet '" + config.getPortletName() + "' failed; the following required properties were missing: " + StringUtils.collectionToDelimitedString(missingProps, ", ")); } }
@Test public void bindingNoErrors() throws Exception { FieldAccessBean rod = new FieldAccessBean(); DataBinder binder = new DataBinder(rod, "person"); assertTrue(binder.isIgnoreUnknownFields()); binder.initDirectFieldAccess(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("name", "Rod")); pvs.addPropertyValue(new PropertyValue("age", new Integer(32))); pvs.addPropertyValue(new PropertyValue("nonExisting", "someValue")); binder.bind(pvs); binder.close(); assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed age correctly", rod.getAge() == 32); Map<?, ?> m = binder.getBindingResult().getModel(); assertTrue("There is one element in map", m.size() == 2); FieldAccessBean tb = (FieldAccessBean) m.get("person"); assertTrue("Same object", tb.equals(rod)); }
@Test public void bindingNoErrorsNotIgnoreUnknown() throws Exception { FieldAccessBean rod = new FieldAccessBean(); DataBinder binder = new DataBinder(rod, "person"); binder.initDirectFieldAccess(); binder.setIgnoreUnknownFields(false); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("name", "Rod")); pvs.addPropertyValue(new PropertyValue("age", new Integer(32))); pvs.addPropertyValue(new PropertyValue("nonExisting", "someValue")); try { binder.bind(pvs); fail("Should have thrown NotWritablePropertyException"); } catch (NotWritablePropertyException ex) { // expected } }
@Test public void nestedBindingWithDefaultConversionNoErrors() throws Exception { FieldAccessBean rod = new FieldAccessBean(); DataBinder binder = new DataBinder(rod, "person"); assertTrue(binder.isIgnoreUnknownFields()); binder.initDirectFieldAccess(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("spouse.name", "Kerry")); pvs.addPropertyValue(new PropertyValue("spouse.jedi", "on")); binder.bind(pvs); binder.close(); assertEquals("Kerry", rod.getSpouse().getName()); assertTrue((rod.getSpouse()).isJedi()); }
@Test public void testAspectsAndAdvisorAreAppliedEvenIfComingFromParentFactory() { ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml"); GenericApplicationContext childAc = new GenericApplicationContext(ac); // Create a child factory with a bean that should be woven RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); bd.getPropertyValues().addPropertyValue(new PropertyValue("name", "Adrian")) .addPropertyValue(new PropertyValue("age", new Integer(34))); childAc.registerBeanDefinition("adrian2", bd); // Register the advisor auto proxy creator with subclass childAc.registerBeanDefinition(AnnotationAwareAspectJAutoProxyCreator.class.getName(), new RootBeanDefinition( AnnotationAwareAspectJAutoProxyCreator.class)); childAc.refresh(); ITestBean beanFromChildContextThatShouldBeWeaved = (ITestBean) childAc.getBean("adrian2"); //testAspectsAndAdvisorAreApplied(childAc, (ITestBean) ac.getBean("adrian")); doTestAspectsAndAdvisorAreApplied(childAc, beanFromChildContextThatShouldBeWeaved); }
/** * Create new ServletConfigPropertyValues. * @param config ServletConfig we'll use to take PropertyValues from * @param requiredProperties set of property names we need, where * we can't accept default values * @throws ServletException if any required properties are missing */ public ServletConfigPropertyValues(ServletConfig config, Set<String> requiredProperties) throws ServletException { Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ? new HashSet<String>(requiredProperties) : null; Enumeration<String> en = config.getInitParameterNames(); while (en.hasMoreElements()) { String property = en.nextElement(); Object value = config.getInitParameter(property); addPropertyValue(new PropertyValue(property, value)); if (missingProps != null) { missingProps.remove(property); } } // Fail if we are still missing properties. if (missingProps != null && missingProps.size() > 0) { throw new ServletException( "Initialization from ServletConfig for servlet '" + config.getServletName() + "' failed; the following required properties were missing: " + StringUtils.collectionToDelimitedString(missingProps, ", ")); } }
@Test public void testBeanNameViewResolver() throws ServletException { StaticWebApplicationContext wac = new StaticWebApplicationContext(); wac.setServletContext(new MockServletContext()); MutablePropertyValues pvs1 = new MutablePropertyValues(); pvs1.addPropertyValue(new PropertyValue("url", "/example1.jsp")); wac.registerSingleton("example1", InternalResourceView.class, pvs1); MutablePropertyValues pvs2 = new MutablePropertyValues(); pvs2.addPropertyValue(new PropertyValue("url", "/example2.jsp")); wac.registerSingleton("example2", JstlView.class, pvs2); BeanNameViewResolver vr = new BeanNameViewResolver(); vr.setApplicationContext(wac); wac.refresh(); View view = vr.resolveViewName("example1", Locale.getDefault()); assertEquals("Correct view class", InternalResourceView.class, view.getClass()); assertEquals("Correct URL", "/example1.jsp", ((InternalResourceView) view).getUrl()); view = vr.resolveViewName("example2", Locale.getDefault()); assertEquals("Correct view class", JstlView.class, view.getClass()); assertEquals("Correct URL", "/example2.jsp", ((JstlView) view).getUrl()); }
/** * Must contain: forname=Tony surname=Blair age=50 */ protected void doTestTony(PropertyValues pvs) throws Exception { assertTrue("Contains 3", pvs.getPropertyValues().length == 3); assertTrue("Contains forname", pvs.contains("forname")); assertTrue("Contains surname", pvs.contains("surname")); assertTrue("Contains age", pvs.contains("age")); assertTrue("Doesn't contain tory", !pvs.contains("tory")); PropertyValue[] pvArray = pvs.getPropertyValues(); Map<String, String> m = new HashMap<String, String>(); m.put("forname", "Tony"); m.put("surname", "Blair"); m.put("age", "50"); for (PropertyValue pv : pvArray) { Object val = m.get(pv.getName()); assertTrue("Can't have unexpected value", val != null); assertTrue("Val i string", val instanceof String); assertTrue("val matches expected", val.equals(pv.getValue())); m.remove(pv.getName()); } assertTrue("Map size is 0", m.size() == 0); }
/** * Must contain: forname=Tony surname=Blair age=50 */ protected void doTestTony(PropertyValues pvs) throws Exception { assertTrue("Contains 3", pvs.getPropertyValues().length == 3); assertTrue("Contains forname", pvs.contains("forname")); assertTrue("Contains surname", pvs.contains("surname")); assertTrue("Contains age", pvs.contains("age")); assertTrue("Doesn't contain tory", !pvs.contains("tory")); PropertyValue[] ps = pvs.getPropertyValues(); Map<String, String> m = new HashMap<String, String>(); m.put("forname", "Tony"); m.put("surname", "Blair"); m.put("age", "50"); for (int i = 0; i < ps.length; i++) { Object val = m.get(ps[i].getName()); assertTrue("Can't have unexpected value", val != null); assertTrue("Val i string", val instanceof String); assertTrue("val matches expected", val.equals(ps[i].getValue())); m.remove(ps[i].getName()); } assertTrue("Map size is 0", m.size() == 0); }
@Test public void testComplexObject() { TestBean tb = new TestBean(); String newName = "Rod"; String tbString = "Kerry_34"; BeanWrapper bw = new BeanWrapperImpl(tb); bw.registerCustomEditor(ITestBean.class, new TestBeanEditor()); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("age", new Integer(55))); pvs.addPropertyValue(new PropertyValue("name", newName)); pvs.addPropertyValue(new PropertyValue("touchy", "valid")); pvs.addPropertyValue(new PropertyValue("spouse", tbString)); bw.setPropertyValues(pvs); assertTrue("spouse is non-null", tb.getSpouse() != null); assertTrue("spouse name is Kerry and age is 34", tb.getSpouse().getName().equals("Kerry") && tb.getSpouse().getAge() == 34); }
@Test public void testComplexObjectWithOldValueAccess() { TestBean tb = new TestBean(); String newName = "Rod"; String tbString = "Kerry_34"; BeanWrapper bw = new BeanWrapperImpl(tb); bw.setExtractOldValueForEditor(true); bw.registerCustomEditor(ITestBean.class, new OldValueAccessingTestBeanEditor()); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("age", new Integer(55))); pvs.addPropertyValue(new PropertyValue("name", newName)); pvs.addPropertyValue(new PropertyValue("touchy", "valid")); pvs.addPropertyValue(new PropertyValue("spouse", tbString)); bw.setPropertyValues(pvs); assertTrue("spouse is non-null", tb.getSpouse() != null); assertTrue("spouse name is Kerry and age is 34", tb.getSpouse().getName().equals("Kerry") && tb.getSpouse().getAge() == 34); ITestBean spouse = tb.getSpouse(); bw.setPropertyValues(pvs); assertSame("Should have remained same object", spouse, tb.getSpouse()); }
@Test public void testAutowireWithUnsatisfiedConstructorDependency() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("name", "Rod")); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); bd.setPropertyValues(pvs); lbf.registerBeanDefinition("rod", bd); assertEquals(1, lbf.getBeanDefinitionCount()); try { lbf.autowire(UnsatisfiedConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, true); fail("Should have unsatisfied constructor dependency on SideEffectBean"); } catch (UnsatisfiedDependencyException ex) { // expected } }
@Test public void testExtensiveCircularReference() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); for (int i = 0; i < 1000; i++) { MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("spouse", new RuntimeBeanReference("bean" + (i < 99 ? i + 1 : 0)))); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); bd.setPropertyValues(pvs); lbf.registerBeanDefinition("bean" + i, bd); } lbf.preInstantiateSingletons(); for (int i = 0; i < 1000; i++) { TestBean bean = (TestBean) lbf.getBean("bean" + i); TestBean otherBean = (TestBean) lbf.getBean("bean" + (i < 99 ? i + 1 : 0)); assertTrue(bean.getSpouse() == otherBean); } }
/** * Modify the property values so that period separated property paths are valid for * map keys. Also creates new maps for properties of map type that are null (assuming * all maps are potentially nested). The standard bracket {@code[...]} dereferencing * is also accepted. * @param propertyValues the property values * @param target the target object * @return modified property values */ private MutablePropertyValues modifyProperties(MutablePropertyValues propertyValues, Object target) { propertyValues = getPropertyValuesForNamePrefix(propertyValues); if (target instanceof MapHolder) { propertyValues = addMapPrefix(propertyValues); } BeanWrapper wrapper = new BeanWrapperImpl(target); wrapper.setConversionService( new RelaxedConversionService(getConversionService())); wrapper.setAutoGrowNestedPaths(true); List<PropertyValue> sortedValues = new ArrayList<PropertyValue>(); Set<String> modifiedNames = new HashSet<String>(); List<String> sortedNames = getSortedPropertyNames(propertyValues); for (String name : sortedNames) { PropertyValue propertyValue = propertyValues.getPropertyValue(name); PropertyValue modifiedProperty = modifyProperty(wrapper, propertyValue); if (modifiedNames.add(modifiedProperty.getName())) { sortedValues.add(modifiedProperty); } } return new MutablePropertyValues(sortedValues); }
private MutablePropertyValues getPropertyValuesForNamePrefix( MutablePropertyValues propertyValues) { if (!StringUtils.hasText(this.namePrefix) && !this.ignoreNestedProperties) { return propertyValues; } MutablePropertyValues rtn = new MutablePropertyValues(); for (PropertyValue value : propertyValues.getPropertyValues()) { String name = value.getName(); for (String prefix : new RelaxedNames(stripLastDot(this.namePrefix))) { for (String separator : new String[] { ".", "_" }) { String candidate = (StringUtils.hasLength(prefix) ? prefix + separator : prefix); if (name.startsWith(candidate)) { name = name.substring(candidate.length()); if (!(this.ignoreNestedProperties && name.contains("."))) { PropertyOrigin propertyOrigin = OriginCapablePropertyValue .getOrigin(value); rtn.addPropertyValue(new OriginCapablePropertyValue(name, value.getValue(), propertyOrigin)); } } } } } return rtn; }
@Override public void setPropertyValue(PropertyValue pv) throws BeansException { try { super.setPropertyValue(pv); } catch (NotWritablePropertyException ex) { PropertyOrigin origin = OriginCapablePropertyValue.getOrigin(pv); if (isBenign(origin)) { logger.debug("Ignoring benign property binding failure", ex); return; } if (origin == null) { throw ex; } throw new RelaxedBindingNotWritablePropertyException(ex, origin); } }
@Test public void testOrderPreserved() { LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>(); map.put("one", 1); map.put("two", 2); map.put("three", 3); map.put("four", 4); map.put("five", 5); this.propertySources.addFirst(new MapPropertySource("ordered", map)); PropertySourcesPropertyValues propertyValues = new PropertySourcesPropertyValues( this.propertySources); PropertyValue[] values = propertyValues.getPropertyValues(); assertThat(values).hasSize(6); Collection<String> names = new ArrayList<String>(); for (PropertyValue value : values) { names.add(value.getName()); } assertThat(names).containsExactly("one", "two", "three", "four", "five", "name"); }
@Override public Class<?> predictBeanType(Class<?> beanClass, String beanName) { if (null == context || !REPOSITORY_TYPE.isAssignableFrom(beanClass)) { return null; } Class<?> resolvedBeanClass = cache.get(beanName); if (resolvedBeanClass != null) { return resolvedBeanClass == Void.class ? null : resolvedBeanClass; } BeanDefinition definition = context.getBeanDefinition(beanName); PropertyValue value = definition.getPropertyValues().getPropertyValue(AbstractStoreBeanDefinitionRegistrar.STORE_INTERFACE_PROPERTY); resolvedBeanClass = getClassForPropertyValue(value, beanName); cache.put(beanName, resolvedBeanClass); return resolvedBeanClass == Void.class ? null : resolvedBeanClass; }
/** * Returns the class which is configured in the given {@link PropertyValue}. In case it is not a * {@link TypedStringValue} or the value contained cannot be interpreted as {@link Class} it will return null. * * @param propertyValue * @param beanName * @return */ private Class<?> getClassForPropertyValue(PropertyValue propertyValue, String beanName) { Object value = propertyValue.getValue(); String className = null; if (value instanceof TypedStringValue) { className = ((TypedStringValue) value).getValue(); } else if (value instanceof String) { className = (String) value; } else if (value instanceof Class<?>) { return (Class<?>) value; } else { return Void.class; } try { return ClassUtils.resolveClassName(className, context.getBeanClassLoader()); } catch (IllegalArgumentException ex) { LOGGER.warn(String.format("Couldn't load class %s referenced as repository interface in bean %s!", className, beanName)); return Void.class; } }
private String updatePropertyValue(String propertyName, PropertyValues values) { PropertyValue property = values.getPropertyValue(propertyName); if (property == null) { return null; } Object value = property.getValue(); if (value == null) { return null; } else if (value instanceof String) { return value.toString(); } else if (value instanceof TypedStringValue) { return ((TypedStringValue) value).getValue(); } else { return null; } }
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { String[] beanNameArray = beanFactory.getBeanDefinitionNames(); for (int i = 0; i < beanNameArray.length; i++) { BeanDefinition beanDef = beanFactory.getBeanDefinition(beanNameArray[i]); String beanClassName = beanDef.getBeanClassName(); if (FEIGN_FACTORY_CLASS.equals(beanClassName) == false) { continue; } MutablePropertyValues mpv = beanDef.getPropertyValues(); PropertyValue pv = mpv.getPropertyValue("name"); String client = String.valueOf(pv.getValue() == null ? "" : pv.getValue()); if (StringUtils.isNotBlank(client)) { this.transientClientSet.add(client); } } this.fireAfterPropertiesSet(); }