我试图找到解决方案,但仍然没有运气。
我正在关注“Pro Spring 3”一书(Appress)[第351页]
我已经将该项目生成为 jpa 项目。
据我了解,我可以persistence.xml
在 bean 内部使用或管理它,这就是我想要的。
对于最新的我们需要定义packagesToScan
属性。
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaPersonService': Injection of persistence dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emf' defined in class path resource [META-INF/app-context.xml]: Error setting property values; nested exception
is **org.springframework.beans.NotWritablePropertyException: Invalid property 'packagesToScan' of bean class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Bean property 'packagesToScan' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
当我尝试询问建议 (ctrl+space) 时,它没有 packagesToScan 属性。
我错过了什么?