I'm new on spring and I want a spring singleton bean to be created when the web application starts, not when it is referenced. Is there a way to achive this? Thanks in advance
This is the default behaviour. Spring beans are non-lazy singletons by default.
<bean id="Example" class="com.domain.Example" singleton="true" lazy-init="false" />
or
<bean id="Example" class="com.domain.Example" />
lazy-init and singleton are set to this value by default.
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