user8971757
user8971757

Reputation: 13

Error creating bean with name 'repositorySearchController' defined in URL [jar:file:/Users/umair/.m2/repository

Unable to understand the below error:

Entity:
package com.example.demo.entity;
import javax.persistence.Entity;
import javax.persistence.Table;

    @Entity
    @Table(name="lecture")
    public class EntityP1 {
            private Long id;
            private String name;
            private String last;
            public Long getId() {
                return id;
            }
            public void setId(Long id) {
                this.id = id;
            }
            public String getName() {
                return name;
            }
            public void setName(String name) {
                this.name = name;
            }
            public String getLast() {
                return last;
            }
            public void setLast(String last) {
                this.last = last;
            }
            
    }
Repository:
package com.example.demo.repo;

import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import com.example.demo.entity.EntityP1;

public interface RepoP1 extends CrudRepository<EntityP1, Long> {

}

Error:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-11-09 09:25:24.133 ERROR 11904 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'repositorySearchController' defined in URL [jar:file:/Users/umair/.m2/repository/org/springframework/data/spring-data-rest-webmvc/3.3.5.RELEASE/spring-data-rest-webmvc-3.3.5.RELEASE.jar!/org/springframework/data/rest/webmvc/RepositorySearchController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pagedResourcesAssembler' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.web.PagedResourcesAssembler]: Factory method 'pagedResourcesAssembler' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pageableResolver' defined in class path resource.......

Upvotes: 1

Views: 987

Answers (1)

Erick Valencia
Erick Valencia

Reputation: 36

You have to add the @EnableJpaRepositories annotation. Here you have more information https://docs.spring.io/spring-data/data-commons/docs/1.6.1.RELEASE/reference/html/repositories.html

Upvotes: 0

Related Questions