Invalid 'packagesToScan' property of bean class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]

I tried to find a solution, but still no luck.

I follow the book "Pro Spring 3" (Appress) [page 351]

I created the project as a jpa project.

As far as I understand, I can either use persistence.xml or independently manage it in a bean, and this is what I want.

For the latter, we must define the packagesToScan property.

 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? 

When I try to request offers (ctrl + space), it does not have the packagesToScan property. enter image description here

What am I missing?

+4
source share
1 answer

'packagesToScan' property was added in Spring 3.1 (compare 3.0 and 3.1 ).

Make sure you include the latest version 3.1 Spring JAR in your CLASSPATH.

+11
source

Source: https://habr.com/ru/post/1415841/


All Articles