I\'m a little confused as to how the inversion of control (IoC) works in Spring.
Say I have a service class called UserServic
How does @Autowired work internally?
Example:
class EnglishGreeting {
private Greeting greeting;
//setter and getter
}
class Greeting {
private String message;
//setter and getter
}
.xml file it will look alike if not using @Autowired:
If you are using @Autowired then:
class EnglishGreeting {
@Autowired //so automatically based on the name it will identify the bean and inject.
private Greeting greeting;
//setter and getter
}
.xml file it will look alike if not using @Autowired:
If still have some doubt then go through below live demo
How does @Autowired work internally ?