2012-04-09 69 views
1

我下spring-app.xml屬性的Spring MVC應用程序

<bean id="mySessionFactory" 
      class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 
     <property name="dataSource" ref="myDataSource" /> 
     <property name="annotatedClasses"> 
      <list> 
       <value>com.mmi.education.dao.User</value> 
      </list> 
     </property> 
     <property name="hibernateProperties"> 
      <props> 
       <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> 
       <prop key="hibernate.show_sql">true</prop> 
       <prop key="hibernate.hbm2ddl.auto">create</prop> 
      </props> 
     </property> 
    </bean> 

而不是財產annotatedClasses讀取Bean代碼,我想指定包。

可能嗎?

另外什麼是可以在bean標籤下指定的有效屬性?

回答

3
<property name="packagesToScan"> 
     <list> 
      <value>com.mmi.education.dao</value> 
     </list> 
    </property> 

查看Spring的文檔here其他屬性。

相關問題