Annotation-based configuration

In AppConfig.java we just created, we used the messageRepository() method and the messageService() method to instantiate MessageRepository and MessageService and incorporate them into the Spring container. This works well when you only have a handful of beans to initialize. However, it would require too much boilerplate code and too much attention to pass dependencies manually through constructors or setters when we have a lot of beans in the application. 

Spring provides annotation-based configuration, which makes the dependencies management much easier. There are mainly two types of annotations that Spring provides. The first type is for declaring beans and the second type is for wiring up the dependencies.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.197.10