Spring 5.0 By Example
上QQ阅读APP看书,第一时间看更新

NewsService

This is an interesting service which will be responsible for managing the state of our news. It will interact like a glue to call the domain models, in this case, the News entity. The service is pretty similar to the others. We received the NewsRepository class, a dependency and kept the repository to maintain the states, let's do that.

The @Service annotation is present again. This is pretty much standard for Spring applications. Also, we can change to the @Component annotation, but it does not make any difference to our application.