bean类的无效属性"packagesToScan"[org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]

Aub*_*ine 4 configuration spring packages spring-orm spring-data-jpa

我试图找到解决方案,但仍然没有运气.

我正在关注"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?
Run Code Online (Sandbox Code Playgroud)

当我尝试寻求建议(ctrl + space)时,它没有packagesToScan属性.在此输入图像描述

我错过了什么?

Tom*_*icz 11

'packagesToScan'属性是在Spring 3.1中添加的(比较3.03.1).

确保在CLASSPATH中包含最新的3.1 Spring JAR.