<?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:context="http://www.springframework.org/schema/context"
????xmlns:aop="http://www.springframework.org/schema/aop"
????xmlns:tx="http://www.springframework.org/schema/tx"
????xsi:schemaLocation="http://www.springframework.org/schema/beans
????????http://www.springframework.org/schema/beans/spring-beans.xsd
????????http://www.springframework.org/schema/context
????????http://www.springframework.org/schema/context/spring-context.xsd
????????http://www.springframework.org/schema/aop
????????http://www.springframework.org/schema/aop/spring-aop.xsd
????????http://www.springframework.org/schema/tx
????????http://www.springframework.org/schema/tx/spring-tx.xsd"?>
????????
?</beans>
???????????????<!--?引入外部的屬性文件?-->
???????????????<context:property-placeholder??location="classpath:jdbc.properties"/>
???????????????<!--?配置連接池?-->
???????????????<bean?id="dataSource"?class="com.mchange.v2.c3p0.ComboPooledDataSource">
??????????????????<property?name="driverClass"?value="${jdbc.driver}"/>
??????????????????<property?name="jdbcUrl"?value="${jdbc.url}"/>
??????????????????<property?name="user"?value="${jdbc.username}"/>
??????????????????<property?name="password"?value="${jdbc.pwd}"/>
???????????????</bean>
???????????????<!--?配置Hibernate相關的屬性文件?-->
???????????????<bean?id="sessionFactory"?class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
?????????????????<!--?注入鏈接池?-->
??????????????????<property?name="dataSource"?ref="dataSource"></property>
??????????????????<!--?配置Hibernate的屬性?-->
??????????????????<property?name="hibernateProperties"?>
?????????????????????<props>
???????????????????????<prop?key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
???????????????????????<prop?key="hibernate.show_sql">true</prop>
???????????????????????<prop?key="hibernate.format_sql">true</prop>
???????????????????????<prop?key="hibernate.hbm2ddl.auto">update</prop>
?????????????????????</props>
??????????????????</property>
??????????????????<!--?加載Hibernate的映射文件?-->
??????????????????<property?name="mappingResources">
????????????????????<list>
????????????????????????<value>cn/muke/ssh/domain/Product.hbm.xml</value>
????????????????????</list>?
??????????????????</property>
???????????????</bean>
<!--?配置Action的類?-->
<bean?id="productAction"?class="cn.muke.ssh.action.ProductAction"
scope="prototype">
<property?name="productService"?ref="productService"></property>
</bean>
<!--?配置業(yè)務層的類?-->
<bean?id="productService"?class="cn.muke.ssh.service.ProductService">
<property?name="productDao"?ref="productDao"></property>
</bean>
<!--?配置DAO的類?-->
<bean?id="productDao"?class="cn.muke.ssh.dao.ProductDao">
</bean>
</beans>
2017-04-23
你解決了嗎?
2017-04-17
2017-04-17