+ 3
What is spring injection?
3 Réponses
+ 4
When you write this for example:
@Autowired
private MyService service;
Then it is the responsibility of the Spring container to gain a reference to a MyService object and set it to the service variable. You can use this feature for example to change implementations without changing the code itself. Change configuration only.
In newer versions of Spring you can use @Inject instead. It is a long topic, can't explained here.
+ 2
It is used in enterprise applications, makes it possible to use loose coupling between software components. You use interfaces and you don't have to determine in your code which implementation will be used. It can be done by an other person via configurations.
+ 1
but what does it offer.