No property xxx found for type 是什么错?findByIsActive、findByAddressCty、大小写写错各报什么?@Query 里写错属性名是不是同一种异常?这篇在 Spring Boot 4.0.8 上逐个启动。
启动失败。异常链:PropertyReferenceException → QueryCreationException → BeanCreationException 最里面一层的信息:No property 'nme' found for type 'Person'; Did you mean 'name','age'
No property 'nme' found,带 Did you mean 建议。
启动失败。异常链:PropertyReferenceException → QueryCreationException → BeanCreationException 最里面一层的信息:No property 'isActive' found for type 'Person'
is 不是 getter 前缀,无建议。
启动失败。异常链:PropertyReferenceException → QueryCreationException → BeanCreationException 最里面一层的信息:No property 'cty' found for type 'Address'; Did you mean 'city'; Traversed path: Person.address
报错带出 Traversed path。
启动失败。异常链:IllegalStateException → QueryCreationException → BeanCreationException 最里面一层的信息:Method expects at least 2 arguments but only found 1; This leaves an operator of type 'SIMPLE_PROPERTY' for property 'age' unbound
IllegalStateException。
启动失败。异常链:PropertyReferenceException → QueryCreationException → BeanCreationException 最里面一层的信息:No property 'firstname' found for type 'Person'; Did you mean 'firstName'
属性名区分大小写。
启动成功 Person findByName → IncorrectResultSizeDataAccessException:Query did not return a unique result: 2 results were returned Optional findOneByName → IncorrectResultSizeDataAccessException:Query did not return a unique result: 2 results were returned
调用时才抛 IncorrectResultSizeDataAccessException。
启动失败。异常链:PathElementException → UnknownPathException → IllegalArgumentException → QueryCreationException → BeanCreationException 最里面一层的信息:Could not resolve attribute 'nme' of 'demo.c7.Person'
Hibernate 的 PathElementException。
启动失败。异常链:UnknownEntityException → IllegalArgumentException → QueryCreationException → BeanCreationException 最里面一层的信息:Could not resolve root entity 'Persn'
UnknownEntityException。