Merge pull request #183 from derkoe
* gh-183: Test that JPA repositories work when called in an init method Closes gh-183
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.example.data.jpa;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AppInitializer implements InitializingBean {
|
||||
|
||||
private AuthorRepository authorRepository;
|
||||
|
||||
public AppInitializer(AuthorRepository authorRepository) {
|
||||
this.authorRepository = authorRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
authorRepository.findByNameContainingIgnoreCase("name");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user