We understand each scope has a different boundary. Now, we will write one REST controller to understand how different scope beans are injected to other reference beans by writing simple Spring boot applications.Â
In the following diagram, the StudentController has injected the reference to all other classes. The ClassDetail class with the session scope has two references to singleton and prototype, and the student application contains a few other associations between classes as well. Autowired annotation is utilized to fulfill dependency between beans. Just to clarify, Spring controllers are always created with the singleton scope:
As we are writing a Spring boot application with REST. Will will have to create a maven project and the configuration of pom.xml file would be:
<?xml version="1.0" encoding="...