Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring引导由以下原因引起:org.springframework.data.mapping.PropertyReferenceException:找不到类型的属性id_Java_Spring Boot - Fatal编程技术网

Java Spring引导由以下原因引起:org.springframework.data.mapping.PropertyReferenceException:找不到类型的属性id

Java Spring引导由以下原因引起:org.springframework.data.mapping.PropertyReferenceException:找不到类型的属性id,java,spring-boot,Java,Spring Boot,我不明白问题出在哪里 存储库类: @Repository public interface PhotoRepository extends JpaRepository<Photo, UUID> { Page<Photo> findByCityId( UUID cityId, Pageable pageable); @存储库 公共界面光电沉积扩展JPA光电沉积{ pagefindbycityid(UUID cityId,Pageable Pageable); 实体类:

我不明白问题出在哪里

存储库类:

@Repository
public interface PhotoRepository extends JpaRepository<Photo, UUID> {
Page<Photo> findByCityId( UUID cityId, Pageable pageable);
@存储库
公共界面光电沉积扩展JPA光电沉积{
pagefindbycityid(UUID cityId,Pageable Pageable);
实体类:

@Entity
@Table (name="photos")
public class Photo {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private UUID idPhoto;

private String name;

private double longitude;

private double latitude;

private byte[] image;

private byte[] thumbnail;

@ManyToOne(fetch= FetchType.LAZY)
@JoinColumn(name="cityId",referencedColumnName = "cityId")
private City city;


@Entity
@Table (name="cities")
public class City {

@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private UUID cityId;

private String name;

private double longitude;

private double latitude;

private int photoCount;



@RestController
public class PhotoController {

@Autowired
private PhotoRepository photoRepository;

@Autowired
private CityRepository cityRepository;

@GetMapping("/cities/{cityId}/photos")
public Page<Photo> getPhotosByCityId(@PathVariable(value = "cityId") UUID cityId,
                                     Pageable pageable)
{
    return photoRepository.findByCityId(cityId,pageable);
}
@实体
@表(name=“照片”)
公开课照片{
@身份证
@GeneratedValue(策略=GenerationType.AUTO)
私人UUID idPhoto;
私有字符串名称;
私人双经度;
私人双纬度;
私有字节[]图像;
私有字节[]缩略图;
@manytone(fetch=FetchType.LAZY)
@JoinColumn(name=“cityId”,referencedColumnName=“cityId”)
私人城市;
@实体
@表(name=“cities”)
公营城市{
@身份证
@GeneratedValue(策略=GenerationType.AUTO)
私人城市;
私有字符串名称;
私人双经度;
私人双纬度;
私人国际光电计数;
@RestController
公共级光电控制器{
@自动连线
私人光电沉积;
@自动连线
私人城市储蓄所城市储蓄所;
@GetMapping(“/cities/{cityId}/photos”)
公共页面getPhotosByCityId(@PathVariable(value=“cityId”)UUID cityId,
可寻呼(可寻呼)
{
返回photopository.findByCityId(cityId,可分页);
}
错误:

 Error starting ApplicationContext. To display the conditions report re-run 
 your application with 'debug' enabled.
2018-10-31 16:26:51.733 ERROR 11112 --- [           main] 
o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'photoController': Unsatisfied dependency expressed 
through field 'photoRepository'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'photoRepository': Invocation of init method failed; nested 
exception is java.lang.IllegalArgumentException: Failed to create query for 
method public abstract org.springframework.data.domain.Page 

com.example.travelg.Repository.PhotoRepository.findByCityId(java.util.UUID,org.springframework.data.domain.Pageable)! No property id found for type City! Traversed path: Photo.city.
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at com.example.travelg.TravelgApplication.main(TravelgApplication.java:11) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'photoRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract org.springframework.data.domain.Page com.example.travelg.Repository.PhotoRepository.findByCityId(java.util.UUID,org.springframework.data.domain.Pageable)! No property id found for type City! Traversed path: Photo.city.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    ... 19 common frames omitted
Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract org.springframework.data.domain.Page com.example.travelg.Repository.PhotoRepository.findByCityId(java.util.UUID,org.springframework.data.domain.Pageable)! No property id found for type City! Traversed path: Photo.city.
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:82) ~[spring-data-jpa-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:103) ~[spring-data-jpa-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:208) ~[spring-data-jpa-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:79) ~[spring-data-jpa-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:553) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:546) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) ~[na:na]
    at java.base/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1050) ~[na:na]
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:548) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:538) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at java.base/java.util.Optional.map(Optional.java:254) ~[na:na]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:538) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$3(RepositoryFactoryBeanSupport.java:287) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:141) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.util.Lazy.get(Lazy.java:63) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:290) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:102) ~[spring-data-jpa-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    ... 29 common frames omitted
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property id found for type City! Traversed path: Photo.city.
    at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:92) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:356) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:332) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:366) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:390) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:332) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:285) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:267) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:250) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.query.parser.Part.<init>(Part.java:81) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:250) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:251) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:380) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:381) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:96) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:76) ~[spring-data-jpa-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    ... 55 common frames omitted
启动ApplicationContext时出错。若要显示条件报告,请重新运行 已启用“调试”的应用程序。 2018-10-31 16:26:51.733错误11112---[main] o、 s.boot.SpringApplication:应用程序运行失败 org.springframework.beans.factory.unsatifiedDependencyException:错误 正在创建名为“photoController”的bean:表示了未满足的依赖关系 通过字段“Photopository”;嵌套异常为 org.springframework.beans.factory.BeanCreationException:创建bean时出错 名称为“Photopository”:调用init方法失败;嵌套 异常为java.lang.IllegalArgumentException:未能为创建查询 方法公共摘要org.springframework.data.domain.Page com.example.travelg.Repository.photopository.findByCityId(java.util.UUID,org.springframework.data.domain.Pageable)!找不到类型City的属性id!遍历路径:Photo.City。 在org.springframework.beans.factory.annotation.AutoWiredNotationBeanPostProcessor$AutoWiredFeldElement.inject(AutoWiredNotationBeanPostProcessor.java:587)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.annotation.AutowiredNotationBeanPostProcessor.postProcessPropertyValues(AutowiredNotationBeanPostProcessor.java:373)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.beans.factory.support.DefaultListableBeanFactory.PreInstanceSingleton(DefaultListableBeanFactory.java:760)~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE] 在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] 在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] 位于org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:327)[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] 在com.example.travelg.travelgaapplication.main(travelgaapplication.java:11)[classes/:na] 原因:org.springframework.beans.factory.BeanCreationException:创建名为“photopository”的bean时出错:调用init方法失败;嵌套异常为java.lang.IllegalArgumentException:未能为方法公共抽象org.springframework.data.domain.Page com.example.travelg.Repository.photopository.findByCi创建查询tyId(java.util.UUID,org.springframework.data.domain.Pageable)!找不到类型City的属性id!遍历路径:Photo。
@Repository
public interface PhotoRepository extends JpaRepository<Photo, UUID> {
Page<Photo> findByCity_CityId( UUID cityId, Pageable pageable);