LaneLane
LaneLane

Reputation: 353

bean instantiation and dependency injection in Spring

I'm new to Spring and I'm trying to understand what happens during runtime. I know that using dependency injection (for example the Setter injection) in Spring enables the Spring container to create these beans or set values to the beans.

However, is this bean creation occurring at runtime or at compile time? If you could give me a link that explains this step by step it'll be really helpful too.

Upvotes: 1

Views: 3186

Answers (1)

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 280178

All bean creation and injection happens at runtime. Spring uses reflection to find types and their methods to do this.

It's explained in detail in the documentation. See chapter 5 on the Inversion of Control Container.

Upvotes: 4

Related Questions