6

I was following a tutorial when building a project in Spring and the @Repository interfaces were extending an other interface JpaRepository which added functionalities to the sub interface:

@Repository("myRepository")
public interface myRepository extends JpaRepository<Name, Long> {

}

In @Service class

@Autowired
private MyRepository myrepo;

@Transactional
public Stuff save(Stuff stuff) {
    return myrepo.save(stuff);
}

I want to find the actual code for the 'SAVE' method. Have downloaded spring-data-commons-core-1.2.1.RELEASE.jar and decompiled but could not find the implementation there.

Dylan Slabbinck
  • 846
  • 1
  • 16
  • 27
Mandy
  • 63
  • 1
  • 5

1 Answers1

4

The Spring framework code is hosted on GitHub. What you are looking for is in this Repository: https://github.com/spring-projects/spring-data-jpa

One implementation is the SimpleJpaRepository: https://github.com/spring-projects/spring-data-jpa/blob/master/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82