Zeeshan
Zeeshan

Reputation: 1183

Spring 3 Dependency Injcetion

I am using Spring3 with xml based configuration. The problem is when the IOC container starts it loads/caches all the properties/fields defined in com.dao.MyDAOFactory class. I want to tell spring that only load/cache specific properties/fields.

The bean declaration is given below

<bean  id="daoFactory" class="com.dao.MyDAOFactory" ></bean>

Can any one help me ?

Upvotes: 1

Views: 145

Answers (1)

iruediger
iruediger

Reputation: 953

You can use the lazy-init attribute to defer the loading of your beans, but eventually all of them will be loaded.

Also keep this in mind that if a non-lazy singleton bean depends on one or more lazy beans, the lazy beans will be loaded at startup.

Upvotes: 1

Related Questions