@@ -88,13 +88,16 @@ protected String determineBeanNameFromAnnotation(AnnotatedBeanDefinition annotat
88
88
for (String type : types ) {
89
89
AnnotationAttributes attributes = MetadataUtils .attributesFor (amd , type );
90
90
if (isStereotypeWithNameValue (type , amd .getMetaAnnotationTypes (type ), attributes )) {
91
- String value = (String ) attributes .get ("value" );
92
- if (StringUtils .hasLength (value )) {
93
- if (beanName != null && !value .equals (beanName )) {
94
- throw new IllegalStateException ("Stereotype annotations suggest inconsistent " +
95
- "component names: '" + beanName + "' versus '" + value + "'" );
91
+ Object value = attributes .get ("value" );
92
+ if (value instanceof String ) {
93
+ String strVal = (String ) value ;
94
+ if (StringUtils .hasLength (strVal )) {
95
+ if (beanName != null && !strVal .equals (beanName )) {
96
+ throw new IllegalStateException ("Stereotype annotations suggest inconsistent " +
97
+ "component names: '" + beanName + "' versus '" + strVal + "'" );
98
+ }
99
+ beanName = strVal ;
96
100
}
97
- beanName = value ;
98
101
}
99
102
}
100
103
}
@@ -117,9 +120,7 @@ protected boolean isStereotypeWithNameValue(String annotationType,
117
120
annotationType .equals ("javax.annotation.ManagedBean" ) ||
118
121
annotationType .equals ("javax.inject.Named" );
119
122
120
- return (isStereotype && attributes != null &&
121
- attributes .containsKey ("value" ) &&
122
- attributes .get ("value" ) instanceof String );
123
+ return (isStereotype && attributes != null && attributes .containsKey ("value" ));
123
124
}
124
125
125
126
/**
0 commit comments