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 +空格)時,它沒有packagesToScan屬性。
我錯過了什麼?
更新了maven - works,很高興不要創建額外的persistence.xml – Aubergine