-1
Initially I am trying to make a call GET of a Book passing with the parameter the title attribute of the Book, later I intend to make a query of a Book by passing as parameter the title and the gender of a given Book. I bumped into the first step :(
Livrorepository
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.alexandre.biblioteca.domain.Livro;
@Repository
public interface LivroRepository extends JpaRepository<Livro, Integer>{
@Transactional(readOnly=true)
@Query("SELECT obj FROM Livro obj WHERE obj.titulo LIKE %:titulo%")
Page<Livro> findByTitulo(@Param("titulo")String titulo, PageRequest pageRequest);
}
Livroresource
import java.net.URI;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import com.alexandre.biblioteca.domain.Livro;
import com.alexandre.biblioteca.domain.dto.LivroDTO;
import com.alexandre.biblioteca.domain.dto.LivroNewDTO;
import com.alexandre.biblioteca.resourses.utils.URL;
import com.alexandre.biblioteca.services.LivroService;
@RestController
@RequestMapping(value = "/livros")
public class LivroResource {
@Autowired
private LivroService service;
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<Livro> find(@PathVariable Integer id) {
Livro obj = service.findById(id);
return ResponseEntity.ok().body(obj);
}
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Void> insert(@Valid @RequestBody LivroNewDTO objDto){
Livro obj = service.fromDTO(objDto);
obj = service.insert(obj);
URI uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(obj.getId()).toUri();
return ResponseEntity.created(uri).build();
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public ResponseEntity<Void> update(@Valid @RequestBody LivroDTO objDto, @PathVariable Integer id){
Livro obj = service.fromDTO(objDto);
obj.setId(id);
obj = service.update(obj);
return ResponseEntity.noContent().build();
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ResponseEntity<Livro> delete(@PathVariable Integer id) {
service.delete(id);
return ResponseEntity.noContent().build();
}
@RequestMapping(method=RequestMethod.GET)
public ResponseEntity<List<LivroDTO>> findAll() {
List<Livro> list = service.findAll();
List<LivroDTO> listDto = list.stream().map(obj -> new LivroDTO(obj)).collect(Collectors.toList());
return ResponseEntity.ok().body(listDto);
}
@RequestMapping(value = "/page", method=RequestMethod.GET)
public ResponseEntity<Page<LivroDTO>> findPage(
@RequestParam(name = "page", defaultValue = "0") Integer page,
@RequestParam(name = "linesPerPage", defaultValue = "24") Integer linesPerPage,
@RequestParam(name = "orderBy", defaultValue = "titulo") String orderBy,
@RequestParam(name = "direction", defaultValue = "ASC") String direction) {
Page<Livro> list = service.findPage(page, linesPerPage, orderBy, direction);
Page<LivroDTO> listDto = list.map(obj -> new LivroDTO(obj));
return ResponseEntity.ok().body(listDto);
}
@RequestMapping(value = "/search", method = RequestMethod.GET)
public ResponseEntity<Page<LivroDTO>> findPage(
@RequestParam(value="titulo", defaultValue="") String titulo,
@RequestParam(value="page", defaultValue="0") Integer page,
@RequestParam(value="linesPerPage", defaultValue="24") Integer linesPerPage,
@RequestParam(value="orderBy", defaultValue="titulo") String orderBy,
@RequestParam(value="direction", defaultValue="ASC") String direction) {
String tituloDecoded = URL.decodeParam(titulo);
Page<Livro> list = service.search(tituloDecoded, page, linesPerPage, orderBy, direction);
Page<LivroDTO> listDto = list.map(obj -> new LivroDTO(obj));
return ResponseEntity.ok().body(listDto);
}
}
Livroservice
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alexandre.biblioteca.domain.Exemplar;
import com.alexandre.biblioteca.domain.Livro;
import com.alexandre.biblioteca.domain.dto.LivroDTO;
import com.alexandre.biblioteca.domain.dto.LivroNewDTO;
import com.alexandre.biblioteca.domain.enums.StatusLivro;
import com.alexandre.biblioteca.repositories.ExemplarRepository;
import com.alexandre.biblioteca.repositories.LivroRepository;
import com.alexandre.biblioteca.services.exceptions.DataIntegrityException;
import com.alexandre.biblioteca.services.exceptions.ObjectNotFoundException;
@Service
public class LivroService {
@Autowired
private LivroRepository repo;
@Autowired
private ExemplarRepository exemplarRepository;
public Livro findById(Integer id) {
Optional<Livro> obj = repo.findById(id);
return obj.orElseThrow(() -> new ObjectNotFoundException(
"Objeto não encontrado! Id: " + id + ", Tipo: " + Livro.class.getName()));
}
@Transactional
public Livro insert(Livro obj) {
obj.setId(null);
obj = repo.save(obj);
exemplarRepository.saveAll(obj.getExemplares());
return obj;
}
public Livro update(Livro obj) {
Livro newObj = findById(obj.getId());
updateData(newObj, obj);
return repo.save(newObj);
}
public void delete(Integer id) {
findById(id);
try {
repo.deleteById(id);
} catch(DataIntegrityViolationException e) {
throw new DataIntegrityException("Não é possível excluir um Livro que está associados a um Empréstimo!");
}
}
public List<Livro> findAll(){
return repo.findAll();
}
public Page<Livro> findPage(Integer page, Integer linesPerPage, String orderBy, String direction){
PageRequest pageRequest = PageRequest.of(page, linesPerPage, Direction.valueOf(direction), orderBy);
return repo.findAll(pageRequest);
}
public Livro fromDTO(LivroDTO objDto) {
return new Livro(objDto.getId(), objDto.getTitulo(), objDto.getSinopse(), objDto.getIsbn(), objDto.getEditora(), objDto.getGenero(), objDto.getIdioma(), objDto.getNumPaginas());
}
public Livro fromDTO(LivroNewDTO objDto) {
Livro livro = new Livro(null, objDto.getTitulo(), objDto.getSinopse(), objDto.getIsbn(), objDto.getEditora(), objDto.getGenero(), objDto.getIdioma(), objDto.getNumPaginas());
Exemplar exemplar = new Exemplar(null, objDto.getIdentificador(), objDto.getQr_code(), objDto.getData_aquisicao(), objDto.getPreco_unitario(), StatusLivro.toEnum(objDto.getStatus()), objDto.getEdicao(), livro);
livro.getExemplares().add(exemplar);
return livro;
}
private void updateData(Livro newObj, Livro obj) {
newObj.setTitulo(obj.getTitulo());
newObj.setSinopse(obj.getSinopse());
newObj.setIsbn(obj.getIsbn());
newObj.setEditora(obj.getEditora());
newObj.setGenero(obj.getGenero());
newObj.setIdioma(obj.getIdioma());
newObj.setNumPaginas(obj.getNumPaginas());
}
public Page<Livro> search(String titulo, Integer page, Integer linesPerPage, String orderBy,
String direction) {
PageRequest pageRequest = PageRequest.of(page, linesPerPage, Direction.valueOf(direction), orderBy);
return repo.findByTitulo(titulo, pageRequest);
}
}
Book
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
@Entity
public class Livro implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String titulo;
private String sinopse;
private String isbn;
private String editora;
private String genero;
private String idioma;
private String numPaginas;
@ManyToMany
@JoinTable(name = "LIVRO_AUTOR",
joinColumns = @JoinColumn(name = "livro_id"),
inverseJoinColumns = @JoinColumn(name = "autor_id"))
private List<Autor> autores = new ArrayList<>();
@OneToMany(mappedBy = "livro", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Exemplar> exemplares = new ArrayList<>();
public Livro() {
}
public Livro(Integer id, String titulo, String sinopse, String isbn, String editora,
String genero, String idioma, String numPaginas) {
super();
this.id = id;
this.titulo = titulo;
this.sinopse = sinopse;
this.isbn = isbn;
this.editora = editora;
this.genero = genero;
this.idioma = idioma;
this.numPaginas = numPaginas;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getSinopse() {
return sinopse;
}
public void setSinopse(String sinopse) {
this.sinopse = sinopse;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getEditora() {
return editora;
}
public void setEditora(String editora) {
this.editora = editora;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public String getIdioma() {
return idioma;
}
public void setIdioma(String idioma) {
this.idioma = idioma;
}
public String getNumPaginas() {
return numPaginas;
}
public void setNumPaginas(String numPaginas) {
this.numPaginas = numPaginas;
}
public List<Autor> getAutores() {
return autores;
}
public void setAutores(List<Autor> autores) {
this.autores = autores;
}
public List<Exemplar> getExemplares() {
return exemplares;
}
public void setExemplares(List<Exemplar> exemplares) {
this.exemplares = exemplares;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Livro other = (Livro) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
I’m getting the following error
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bibliotecaApplication': Unsatisfied dependency expressed through field 'livroRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'livroRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Using named parameters for method public abstract org.springframework.data.domain.Page com.alexandre.biblioteca.repositories.LivroRepository.findByTitulo(java.lang.String,org.springframework.data.domain.PageRequest) but parameter 'Optional[pageRequest]' not found in annotated query 'SELECT obj FROM Livro obj WHERE obj.titulo LIKE %:titulo%'!
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at com.alexandre.biblioteca.BibliotecaApplication.main(BibliotecaApplication.java:57) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_241]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_241]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_241]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_241]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.2.4.RELEASE.jar:2.2.4.RELEASE]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'livroRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Using named parameters for method public abstract org.springframework.data.domain.Page com.alexandre.biblioteca.repositories.LivroRepository.findByTitulo(java.lang.String,org.springframework.data.domain.PageRequest) but parameter 'Optional[pageRequest]' not found in annotated query 'SELECT obj FROM Livro obj WHERE obj.titulo LIKE %:titulo%'!
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 24 common frames omitted
Caused by: java.lang.IllegalStateException: Using named parameters for method public abstract org.springframework.data.domain.Page com.alexandre.biblioteca.repositories.LivroRepository.findByTitulo(java.lang.String,org.springframework.data.domain.PageRequest) but parameter 'Optional[pageRequest]' not found in annotated query 'SELECT obj FROM Livro obj WHERE obj.titulo LIKE %:titulo%'!
at org.springframework.data.jpa.repository.query.JpaQueryMethod.assertParameterNamesInAnnotatedQuery(JpaQueryMethod.java:156) ~[spring-data-jpa-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.jpa.repository.query.JpaQueryMethod.<init>(JpaQueryMethod.java:135) ~[spring-data-jpa-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:78) ~[spring-data-jpa-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:574) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:567) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_241]
at java.util.Iterator.forEachRemaining(Unknown Source) ~[na:1.8.0_241]
at java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Unknown Source) ~[na:1.8.0_241]
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[na:1.8.0_241]
at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:1.8.0_241]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:1.8.0_241]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[na:1.8.0_241]
at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:1.8.0_241]
at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[na:1.8.0_241]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:569) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:559) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at java.util.Optional.map(Unknown Source) ~[na:1.8.0_241]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:559) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:332) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:212) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.util.Lazy.get(Lazy.java:94) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300) ~[spring-data-commons-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:121) ~[spring-data-jpa-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 34 common frames omitted