Access the full course here: javabrains.io/courses/spring_bootquickstart
Learn how to create a Spring business service with the @Service annotation.
38 Comments on "Spring Boot Quick Start 17 – Creating a business service"
hi JavaBrains ! Your course is awesome- thank u !!! Why u write -return topicService.getAllTopics()insteadreturn new TopicService().getAllTopics() –???
Awesome person! Awesome knowledge! Awesome technique to explain! really appreciated!
Are these instances obtained from Pool or are these singleton ?
Its very basic can u please add videos for swagger, performance improvement also
Instead of Spring's Autowired you can use Java's Inject – effect would be the same
Sir what is exactly use of service as when we were using controller same output was generated ie. list of topics
Service is created so that all your Business logic can be put inside that. It's a systematic manner and it is generally preferred.
It works, but How does the Spring inject TopicService? It has a private modifier and there is NO any setters and constructors!
Павел Туз I was wondering the same thing I found on stack overflow that it uses reflecting to wire it up. stackoverflow.com/questions/28694204/how-does-autowired-annotation-works-for-a-private-field
Павел Туз I was wondering the same thing I found on stack overflow that it uses reflection to wire it up. stackoverflow.com/questions/28694204/how-does-autowired-annotation-works-for-a-private-field
@Autowired annotation will do that for you.
In CodeChannels.com, you can learn to code by watching videos and stay up to date with latest code shows, events and tutorials aggregated from various leading developer communities.
Copyright 2016 By CodeChannels.com All rights reserved.