假设我有两个包com.test1和com.test2在不同的模块称为M1(com.test1)和M2(com.test2).
现在在下面的例子中我配置了module1包.
<bean id="entityManager" class="org.springframework.orm.jpa.LocalContainerEntityManagerfactorybean"> <property name="packagesToScan" value="com.test1" /> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter" ref="hibernateVendor" /> <property name="jpaPropertyMap" ref="jpaPropertyMap" /> </bean>
但是我想在packagesToScan属性中配置Module2包.如何配置
我发现回答我的自我.
原文链接:https://www.f2er.com/xml/292957.html<bean id="entityManager" class="org.springframework.orm.jpa.LocalContainerEntityManagerfactorybean"> <property name="packagesToScan"> <array> <value>com.test1</value> <value>com.test2</value> </array> </property> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter" ref="hibernateVendor" /> <property name="jpaPropertyMap" ref="jpaPropertyMap" /> </bean>