2012-06-03 7 views
4

솔루션을 찾으려고했지만 여전히 운이 없습니다.bean 클래스의 'packagesToScan'속성이 올바르지 않습니다. [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]

나는 책 "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 속성이 없습니다. enter image description here

무엇이 누락 되었습니까?

답변

11

'packagesToScan' 속성이 Spring 3.1 (3.03.1 비교)에 추가되었습니다.

CLASSPATH에 최신 3.1 Spring JAR을 포함해야합니다.

+0

업데이트 됨 maven - 작동하여 추가 persistence.xml을 생성하지 않아도됩니다. – Aubergine