how does maping work in spring?

0

I have the following code:

import java.util.List;

import org.springframework.data.repository.Repository;

import net.javabeat.spring.data.domain.Book;

public interface BookNamedQueryRepositoryExample extends Repository<Book, Long> {
    // Query will be used from Named query defined at Entity class
    List<Book> findByPrice(long price);
}

I reviewed the entire project, and there is nowhere to implement the method, but it works when I do the test, what kind of magic is this? Why does it work if there is no implementation?

    
asked by deluf 01.05.2017 в 06:52
source

1 answer

2

Spring Data JPA uses a library called Javassist (JAVA programming ASSISTant) to add a runtime implementation to each interface that extends from org.springframework.data.repository.Repository .

    
answered by 01.05.2017 в 18:12