Giriş
Şu satırı dahil ederiz.
Hiçbir arayüzden kalıtmayan kendi sınıfımız için şöyle yaparız.
Şu satırı dahil ederiz.
import org.springframework.stereotype.Repository;Spring Data can create implementations for you of @Repository interfaces of various flavours. Spring Boot will handle all of that for you as long as those @Repositories are included in the same package (or a sub-package) of your @EnableAutoConfiguration class.Normalde Repository sınıfları JpaRepository, CrudRepository arayüzlerinden kalıtır. Bu anotasyonun diğer'leri ile karşılaştırması şöyle.
| Annotation | Meaning                                             |
+------------+-----------------------------------------------------+
| @Component | generic stereotype for any Spring-managed component |
| @Repository| stereotype for persistence layer                    |
| @Service   | stereotype for service layer                        |
| @Controller| stereotype for presentation layer (spring-mvc)   Hiçbir arayüzden kalıtmayan kendi sınıfımız için şöyle yaparız.
@Repository
public class MyRepository {
  ...
} 
Hiç yorum yok:
Yorum Gönder