Spring container and beans

The Spring container (inversion of control) creates, wires, and manages the lifecycle of the application's objects, called beans. Classes annotated with @Component, @Service, @Repository, or declared with @Bean are detected, and their dependencies injected, preferably through the constructor. By default, a bean is a singleton.

Example

@Service
class ClientService {
    ClientService(ClientRepository repo) {...}
}

Related concepts

The whole glossary