[JIRA] (JSSH-34) Process nested beans in RelocatedBeanFactoryPostProcessor

Ian Young (Jira) jira at shibboleth.atlassian.net
Tue Jun 20 15:28:43 UTC 2023


Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 ) *created* an issue

Shibboleth Shared - Java ( https://shibboleth.atlassian.net/browse/JSSH?atlOrigin=eyJpIjoiYmM0ZjI4MDViYjE4NDc4NDhjMjI2MThhNzk3YWU3NTMiLCJwIjoiaiJ9 ) / Improvement ( https://shibboleth.atlassian.net/browse/JSSH-34?atlOrigin=eyJpIjoiYmM0ZjI4MDViYjE4NDc4NDhjMjI2MThhNzk3YWU3NTMiLCJwIjoiaiJ9 ) JSSH-34 ( https://shibboleth.atlassian.net/browse/JSSH-34?atlOrigin=eyJpIjoiYmM0ZjI4MDViYjE4NDc4NDhjMjI2MThhNzk3YWU3NTMiLCJwIjoiaiJ9 ) Process nested beans in RelocatedBeanFactoryPostProcessor ( https://shibboleth.atlassian.net/browse/JSSH-34?atlOrigin=eyJpIjoiYmM0ZjI4MDViYjE4NDc4NDhjMjI2MThhNzk3YWU3NTMiLCJwIjoiaiJ9 )

Issue Type: Improvement Assignee: Unassigned Created: 20/Jun/23 11:28 AM Priority: Trivial Reporter: Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 )

RelocatedBeanFactoryPostProcessor operates by iterating over the beanFactory.getBeanDefinitionNames. This only provides access to named beans, normally top-level ones. Nested beans are not visible here and so can’t be relocated.

It might be possible to make this more useful by locating and processing at least some of the nested beans by walking the tree as suggested in this comment:

https://stackoverflow.com/questions/10002898/can-a-spring-beanfactorypostprocessor-find-nested-beans-with-no-name

These days, with Java 17, it looks like the new instanceof construct would simplify their example code to:

for every named bean definition {
   BeanDefinition parentDef = beanFactory.getBeanDefinition(defName);
   // handle the parent definition as before
   for (PropertyValue property : parentDef.getPropertyValues()) {
   if (property.getValue() instanceof BeanDefinitionHolder nestedDef) {
       // handle nested definition
   }
}

but, you know, with recursion.

There are probably diminishing returns here; it’s probably not worth trying to walk through things like maps.

( https://shibboleth.atlassian.net/browse/JSSH-34#add-comment?atlOrigin=eyJpIjoiYmM0ZjI4MDViYjE4NDc4NDhjMjI2MThhNzk3YWU3NTMiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/JSSH-34#add-comment?atlOrigin=eyJpIjoiYmM0ZjI4MDViYjE4NDc4NDhjMjI2MThhNzk3YWU3NTMiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:8ffa416 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/commits/attachments/20230620/4ef46fd7/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-dd03551a-0c99-4f36-9a5d-2933fff4b937
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20230620/4ef46fd7/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-ff4e31f5-7399-477f-ae02-81b25b9dca7d
Type: image/png
Size: 448 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20230620/4ef46fd7/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-trivial-887eb40a-2ded-48ef-8e8b-50078f264609
Type: image/png
Size: 446 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20230620/4ef46fd7/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-75a1966f-e3ad-4704-9da7-901287436ba2
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20230620/4ef46fd7/attachment-0007.png>


More information about the commits mailing list