[Java] Spring DI ④ --Life cycle management

What is DI lifecycle management?

What is lifecycle management?

What is a scope?

How to use Scope

@Component
@Scope("prototype")
public class SampleComponent{

}

Scope specified by @Scope

Note 1: The default is singleton

Note 2: If the field has instances with different scopes

//It becomes a singleton scope
@Component
@Scope("prototype")
public class PrototypeComponent{

}
@Component
public class SingletonComponent{	
    @Autowired
    private PrototypeComponent component;
}

Recommended Posts

[Java] Spring DI ④ --Life cycle management
[Java] Spring DI ③
Spring bean life cycle
[Java] How Spring DI works
Spring Java
Activity life cycle
Spring Framework Summary-About DI
[Java] Package for management
About DI of Spring ①
First Spring Boot (DI)
Spring Basics ~ DI Edition ~
Spring + Gradle + Java Quick Start
Bean scope and Bean Life Cycle
[Java] Thymeleaf Basic (Spring Boot)
Introduction to Spring Boot ① ~ DI ~
About the Android life cycle
CICS-Run Java application-(4) Spring Boot application
Using Mapper with Java (Spring)
Java life starting from scratch
[Java] [Spring] Spring Boot 1.4-> 1.2 Downgrade Note
About Spring DI related annotations