Skip to content

Defining a service the Spring way.#11

Open
vdumitrescu wants to merge 1 commit intojuleswhite:masterfrom
vdumitrescu:spring-service
Open

Defining a service the Spring way.#11
vdumitrescu wants to merge 1 commit intojuleswhite:masterfrom
vdumitrescu:spring-service

Conversation

@vdumitrescu
Copy link

If we define the VideoFileManager as a @service, Spring will instantiate an instance during the application startup, and this can easily be referred from other classes using @Autowired:

@Autowired private VideoFileManager videoFileManager;

No need to implement a Singleton pattern, as Spring IoC will do it for us.

@juleswhite
Copy link
Owner

This is a nice enhancement. I don't cover @service in the course (although this would be nice to add), so I don't want to add this to the assignment and potentially confuse people. Also, we want to freeze the assignment and only apply bug fixes or README clarifications at this point. I do like this change, so I will merge it in for the next version of the course and update the lectures to cover dependency injection and @service before the first assignment.

@juleswhite
Copy link
Owner

I went ahead and updated one of the lectures to mention @service. I am still going to wait to merge this pull request until the end of the class. Not including this in the assignment will allow people to discover on their own that they can either add @service or incorporate it into the Application as an @bean method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants