@@ -244,13 +244,15 @@ private CachedIntrospectionResults(Class beanClass) throws BeansException {
244
244
// This call is slow so we do it once.
245
245
PropertyDescriptor [] pds = this .beanInfo .getPropertyDescriptors ();
246
246
for (PropertyDescriptor pd : pds ) {
247
- if (Class .class == beanClass && (!"name" .equals (pd .getName ()) && !pd .getName ().endsWith ("Name" ))) {
247
+ if (Class .class == beanClass && !("name" .equals (pd .getName ()) ||
248
+ (pd .getName ().endsWith ("Name" ) && String .class == pd .getPropertyType ()))) {
248
249
// Only allow all name variants of Class properties
249
250
continue ;
250
251
}
251
- if (pd .getPropertyType () != null && (ClassLoader .class .isAssignableFrom (pd .getPropertyType ())
252
- || ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
253
- // Ignore ClassLoader and ProtectionDomain types - nobody needs to bind to those
252
+ if (pd .getWriteMethod () == null && pd .getPropertyType () != null &&
253
+ (ClassLoader .class .isAssignableFrom (pd .getPropertyType ()) ||
254
+ ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
255
+ // Ignore ClassLoader and ProtectionDomain read-only properties - no need to bind to those
254
256
continue ;
255
257
}
256
258
if (logger .isTraceEnabled ()) {
@@ -260,9 +262,10 @@ private CachedIntrospectionResults(Class beanClass) throws BeansException {
260
262
"; editor [" + pd .getPropertyEditorClass ().getName () + "]" : "" ));
261
263
}
262
264
pd = buildGenericTypeAwarePropertyDescriptor (beanClass , pd );
263
- if (pd .getPropertyType () != null && (ClassLoader .class .isAssignableFrom (pd .getPropertyType ())
264
- || ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
265
- // Ignore ClassLoader and ProtectionDomain types - nobody needs to bind to those
265
+ if (pd .getWriteMethod () == null && pd .getPropertyType () != null &&
266
+ (ClassLoader .class .isAssignableFrom (pd .getPropertyType ()) ||
267
+ ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
268
+ // Ignore ClassLoader and ProtectionDomain read-only properties - no need to bind to those
266
269
continue ;
267
270
}
268
271
this .propertyDescriptorCache .put (pd .getName (), pd );
0 commit comments