首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

大家看下小弟我配的spring文件,提点建议

2011-12-10 
大家看下我配的spring文件,提点建议?xmlversion 1.0 encoding UTF-8 ?!DOCTYPEbeansPUBLIC-//SP

大家看下我配的spring文件,提点建议
<?xml   version= "1.0 "   encoding= "UTF-8 "?>
<!DOCTYPE   beans   PUBLIC   "-//SPRING//DTD   BEAN//EN "   "http://www.springframework.org/dtd/spring-beans.dtd ">

<beans>
  <bean   id= "dataSource "   class= "com.mchange.v2.c3p0.ComboPooledDataSource "   destroy-method= "close ">
            <property   name= "driverClass ">
                <value> com.mysql.jdbc.Driver </value>
            </property>
            <property   name= "jdbcUrl ">
                <value> jdbc:mysql://localhost:3306/new_log?characterEncoding=gbk </value>
            </property>
            <property   name= "properties ">
                <props>
                        <prop   key= "c3p0.minPoolSize "> 1 </prop>  
                        <prop   key= "hc3p0.maxPoolSize "> 10 </prop>  
                        <prop   key= "hc3p0.timeout "> 60 </prop>  
                        <prop   key= "c3p0.max_statement "> 50 </prop>  
                        <prop   key= "c3p0.testConnectionOnCheckout "> true </prop>  
                        <prop   key= "hibernate.c3p0.testConnectionOnCheckout "> false </prop>
                        <prop   key= "user "> root </prop>  
                        <prop   key= "password "> </prop>
                </props>
            </property>
        </bean>
       
      <bean   id= "sessionFactory "
                class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean "   singleton= "true ">
               
              <property   name= "dataSource "> <ref   local= "dataSource "/> </property>
               
              <property   name= "mappingResources ">
                        <list>
                                <value> jfw/pojo/Login.hbm.xml </value>


                                <value> jfw/pojo/User.hbm.xml </value>
                        </list>
                </property>
               
                <property   name= "hibernateProperties ">
                      <props>
                          <prop   key= "hibernate.dialect "> org.hibernate.dialect.MySQLDialect </prop>
                          <prop   key= "hibernate.show_sql "> true </prop>
                      </props>
                </property>
               
        </bean>
       
       
        <!--   事务   -->
        <bean   id= "transactionManager "
                class= "org.springframework.orm.hibernate3.HibernateTransactionManager ">
                <property   name= "sessionFactory ">
                        <ref   local= "sessionFactory "/>
                </property>
        </bean>
       
        <bean   id= "baseProxy "   lazy-init= "true "   abstract= "true "  
        class= "org.springframework.transaction.interceptor.TransactionProxyFactoryBean ">
                <property   name= "transactionManager ">
                        <ref   bean= "transactionManager "/>
                </property>
               
                <property   name= "transactionAttributes ">
            <props>
                <prop   key= "* "> PROPAGATION_REQUIRED </prop>
            </props>
        </property>
        </bean>

<!--   ===========================================================================   -->

        <!--   需要事务处理的配置   -->

        <bean   id= "LoginDao "   parent= "baseProxy ">
                <property   name= "target ">


                        <bean   class= "jfw.dao.LoginDao "   autowire= "byName "/>
                </property>
        </bean>
       
       
        <!--   不需要事务处理的配置   -->
        <!--
        <bean   id= "BaseDao "   class= "jfw.dao.BaseDao ">
                <property   name= "sessionFactory ">
                        <ref   bean= "sessionFactory "/>
                </property>
        </bean>
        -->
       

</beans>

[解决办法]
和谐社会

热点排行