@RepositoryRestResource(path = "/region", collectionResourceRel = "list", excerptProjection = CustomRegion.class)
public interface RegionRepository extends JpaRepository<Region, Integer> {
}
数据其余类
@SpringBootApplication
public class ProfUzApplication {
public static void main(String[] args) {
SpringApplication.run(ProfUzApplication.class, args);
}
}
主跑步类
发生的错误
org.springframework.beans.factory.UnsatisfiedDependencyException:创建URL为[jar:file:/ C:/Users/saidk/.m2/repository/org/springframework/data/spring-data的名称为'repositorySearchController'的bean时出错-rest-webmvc / 3.2.1.RELEASE / spring-data-rest-webmvc-3.2.1.RELEASE.jar!/org/springframework/data/rest/webmvc/RepositorySearchController.class]:通过构造函数参数1表示的不满意依赖性;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建在类路径资源[org / springframework / data / rest / webmvc / config / RepositoryRestMvcConfiguration.class]中定义的名称为'entityLinks'的bean时出错:通过工厂方法实例化Bean失败;嵌套的异常是org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.data.rest.webmvc.support.RepositoryEntityLinks]:工厂方法'entityLinks'抛出了异常;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建在类路径资源[org / springframework / data / rest / webmvc / config / RepositoryRestMvcConfiguration.class]中定义的名称为'resourceMappings'的bean时出错:通过工厂方法实例化Bean失败;嵌套的异常是org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.data.rest.core.mapping.RepositoryResourceMappings]:工厂方法'resourceMappings'抛出了异常;嵌套的异常是java.lang.IllegalStateException:为uz.pdp.prof.repository.RegionRepository配置的路径/区域只能包含一个路径段!
几天前,我基于2.2.2创建了一个新项目,并遇到了同样的问题。
经过几次尝试后,解决该问题的方法是在path和collectionResourceRel中使用相同的值。对于您的情况,请尝试在path和collectionResourceRel中同时使用“区域”。