@@ -289,13 +289,15 @@ private CachedIntrospectionResults(Class<?> beanClass) throws BeansException {
289
289
// This call is slow so we do it once.
290
290
PropertyDescriptor [] pds = this .beanInfo .getPropertyDescriptors ();
291
291
for (PropertyDescriptor pd : pds ) {
292
- if (Class .class == beanClass && (!"name" .equals (pd .getName ()) && !pd .getName ().endsWith ("Name" ))) {
292
+ if (Class .class == beanClass && !("name" .equals (pd .getName ()) ||
293
+ (pd .getName ().endsWith ("Name" ) && String .class == pd .getPropertyType ()))) {
293
294
// Only allow all name variants of Class properties
294
295
continue ;
295
296
}
296
- if (pd .getPropertyType () != null && (ClassLoader .class .isAssignableFrom (pd .getPropertyType ())
297
- || ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
298
- // Ignore ClassLoader and ProtectionDomain types - nobody needs to bind to those
297
+ if (pd .getWriteMethod () == null && pd .getPropertyType () != null &&
298
+ (ClassLoader .class .isAssignableFrom (pd .getPropertyType ()) ||
299
+ ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
300
+ // Ignore ClassLoader and ProtectionDomain read-only properties - no need to bind to those
299
301
continue ;
300
302
}
301
303
if (logger .isTraceEnabled ()) {
@@ -305,9 +307,10 @@ private CachedIntrospectionResults(Class<?> beanClass) throws BeansException {
305
307
"; editor [" + pd .getPropertyEditorClass ().getName () + "]" : "" ));
306
308
}
307
309
pd = buildGenericTypeAwarePropertyDescriptor (beanClass , pd );
308
- if (pd .getPropertyType () != null && (ClassLoader .class .isAssignableFrom (pd .getPropertyType ())
309
- || ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
310
- // Ignore ClassLoader and ProtectionDomain types - nobody needs to bind to those
310
+ if (pd .getWriteMethod () == null && pd .getPropertyType () != null &&
311
+ (ClassLoader .class .isAssignableFrom (pd .getPropertyType ()) ||
312
+ ProtectionDomain .class .isAssignableFrom (pd .getPropertyType ()))) {
313
+ // Ignore ClassLoader and ProtectionDomain read-only properties - no need to bind to those
311
314
continue ;
312
315
}
313
316
this .propertyDescriptorCache .put (pd .getName (), pd );
0 commit comments