[Java] Spring DI ③

What are you doing with DI?

Component scan

[Annotation to be scanned]

Instance creation and injection

//image
public class DependencyInjection{
    //Create an instance of each class
    private SampleComponent component = new SampleComponent();
    private SampleService service = new SampleService();
    //Getter for SampleComponent instance
    public static SampleComponent getSampleComponent(){
        return component;
    }
    //Getter for SampleService instance
    public static SampleService getSampleService(){
        return service;
    }
}

So how do you implement it?

Annotation base

JavaConfig

JavaConfig + annotation

xml based

Recommended Posts

[Java] Spring DI ③
Spring Java
[Java] How Spring DI works
Spring Framework Summary-About DI
About DI of Spring ①
First Spring Boot (DI)
Spring Basics ~ DI Edition ~
Spring + Gradle + Java Quick Start
[Java] Thymeleaf Basic (Spring Boot)
Introduction to Spring Boot ① ~ DI ~
Java
CICS-Run Java application-(4) Spring Boot application
Using Mapper with Java (Spring)
Java
About Spring DI related annotations
Spring Boot + Java + GitHub authentication login
Java Spring environment in vs Code
Elastic Beanstalk (Java) + Spring Boot + https
Java --Jersey Framework vs Spring Boot
Implement reCAPTCHA v3 in Java / Spring
Spring Framework tools for Java developer
[Java] LINE integration with Spring Boot
Java learning (0)
Studying Java ―― 3
[Java] array
Java protected
[Java] Annotation
[Java] Module
Java array
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Java methods
Java method
[Java] [Spring] Spring Boot Dependency injection mysterious hamarineta
java (constructor)
Java array
spring × docker
java (override)
java (method)
Java Day 2018
Java string
[Java Spring MVC] Controller for development confirmation
Java static
Java serialization
java beginner 4
JAVA paid
Studying Java ―― 4
Java (set)
About Spring Dependency Injection using Java, Kotlin
After 3 months of Java and Spring training
[Java] compareTo
Studying Java -5
java reflexes
java (interface)
Java memorandum
☾ Java / Collection
Java array
[Java] Array
About Spring ③
Studying Java # 0