解决方案 »

  1.   

    你这个是模仿的别的 demo 还是教程?
    配置文件发一下看看。
      

  2.   

    application 
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><!--数据源配置  -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
    <property name="url" value="jdbc:mysql://localhost:3306/sysmanager">
    </property>
    <property name="username" value="root"></property>
    </bean> <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">


    <property name="configLocation"              value="classpath:hibernate.cfg.xml">          </property>  
            
            
    <property name="mappingResources">
    <list>
    <value>
    com/vst/configmanager/bean/SysConfigItem.hbm.xml
    </value>
    <value>
    com/vst/configmanager/bean/SysConfigCatalogue.hbm.xml
    </value>
    <value>
    com/vst/configmanager/bean/SysCongigIntent.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>
            <prop key="hibernate.hbm2ddl.auto">false</prop>
          </props>
        </property>

    </bean>


    <bean id="myaction"
    class="com.vst.configmanager.action.myAction">
    <property name="myBiz" ref="myBiz"></property>
    </bean>
    <bean id="myBiz"
    class="com.vst.configmanager.biz.impl.MyBiz">
    </bean>
       
    </beans>