Spring 2.5: How to "lazy-init" when using annotations?

R

Robert M.

I'm switching to Spring 2.5 but I'm stuck at one issue. When using the
"old" XML bean configuration, you could specify the "lazy-init"
attribute for each <bean> tag. (If set to "false", the bean is
pre-initialized on startup, if "true", it is only created when it is
actually needed.)

My problem: How can I achieve this when I use @Component annotations to
define my beans?

So far, I have googled and read the Spring documentation without
success. In the 2.5.3 docs, section "3.3.4. Lazily-instantiated beans",
it reads

"When configuring beans via XML, this lazy loading is controlled by the
'lazy-init' attribute on the <bean/> element"

But in the following text, there is no mention of how to do it with
annotations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,786
Messages
2,569,625
Members
45,320
Latest member
icelord

Latest Threads

Top