I am new to Spring boot app. I am not sure about the correct naming and annotation for my app.
I have following service interface.
@Service
public interface StockService {
public String getStockContent();
public List<StockElement> parseStockContents(String stockContent);
}
I have following service implementation
@Service
public class StockServiceImpl implements StockService{
public String getStockContent() {
// IMPL removed because it is not relevant to this question.
}
List<StockElement> parseStockContents(String stockContent) {
// IMPL removed because it is not relevant to this question.
}
}
In terms of functionality, it is working nicely. I have seen there were many mvc naming conventions. Just as model, entity, repository, repositoryImpl, dao, daoImpl, service, serviceImp, controller, etc. They have also annotation accordingly.
I clearly understand model, entity, service, controller.
I have confusion about dao and repository. Also in my code, I have service interface and implementation. I annotated both as @Service and it is working. I have confusion about it. Will both be annotated as @Service. Also, I have seen many places annotation as @Component. What is the use of @Component?
Could you please explain in details with some code snippet?