I have a spring boot application and connected to Mongo DB. I know all most all of documents or blogs said the sample code should like this:
@Repository
public interface ProductRepository extends MongoRepository<Product, String> {
}
@Document
public class Product {
private String id;
private String name;
private int price;
}
But I found even if I remove @Repository and @Document annotations. The application still can start without error. Spring still can know ProductRepository is spring bean and also can CRUD Product collection.
So does these not necessary to add @Repository and @Document? Or is there any difference add or not add?