You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getBeanDefinitionNames should not leak the frozenBeanDefinitionNames array [SPR-14897] #19463
getBeanDefinitionNames leaks the getBeanDefinitionNames array to callers. It's possible for the caller to modify the array, which affects Spring's internal list of the names of beans in the context.
Good point; we're returning a clone of the array now. To be backported to 4.3.5.
FWIW, in the 4.x line, we have a more efficient getBeanNamesIterator() accessor on ConfigurableListableBeanFactory which is preferably used by Spring Boot already.
FWIW, in the 4.x line, we have a more efficient getBeanNamesIterator() accessor on ConfigurableListableBeanFactory which is preferably used by Spring Boot already.
Thanks - I see that was added in commit 965bea7, though that didn't go into Spring 4.0, which we are currently using (yes, we really need to upgrade!).
The reason I'm getting the list of bean names is so that I can sort them alphabetically, and dump out a list of them for diagnostic purposes - so getting an iterator vs. an array doesn't make a huge amount of difference. Thanks for the suggestion though!
Activity
spring-projects-issues commentedon Nov 11, 2016
Juergen Hoeller commented
Good point; we're returning a clone of the array now. To be backported to 4.3.5.
FWIW, in the 4.x line, we have a more efficient
getBeanNamesIterator()accessor onConfigurableListableBeanFactorywhich is preferably used by Spring Boot already.spring-projects-issues commentedon Nov 11, 2016
Richard Fearn commented
Thanks - I see that was added in commit 965bea7, though that didn't go into Spring 4.0, which we are currently using (yes, we really need to upgrade!).
The reason I'm getting the list of bean names is so that I can sort them alphabetically, and dump out a list of them for diagnostic purposes - so getting an iterator vs. an array doesn't make a huge amount of difference. Thanks for the suggestion though!