When I get a spring bean (via getBean()), is there any way to verify from java code that the bean has been defined with scope=prototype ?
Spring config:
<bean class="foo.Bar" scope="prototype" />
Java:sc
MyBean bean = springApplicationContext.getBean("MyBean");
I could just instantiate it twice and compare the objects, but I'd like to avoid unnecessary object creation. Something like the opposite of this answer would do the trick: https://stackoverflow.com/a/9125610/156477
You have a API boolean isPrototype(String name)
in ApplicationContext
to check it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With