`
bo_hai
  • 浏览: 563872 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

applicationContent.xml样例

阅读更多

applicationContent.xml 内容样例如下:

<?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"
	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-2.0.xsd
						http://www.springframework.org/schema/context
						http://www.springframework.org/schema/context/spring-context-2.0.xsd
						http://www.springframework.org/schema/tx
						http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
						http://www.springframework.org/schema/aop
						http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

		
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
		<property name="driverClass" value="com.mysql.jdbc.Driver"/>
		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/shopping?useUnicode=true&amp;characterEncoding=UTF-8"/>
		<property name="user" value="chinese"/>
		<property name="password" value="a123"/>
		<property name="maxPoolSize" value="10"/>
		<property name="minPoolSize" value="1"/>
		<property name="initialPoolSize" value="2"/>
		<property name="autoCommitOnClose" value="false"/>
		<property name="maxIdleTime" value="60"/>
		<property name="acquireIncrement" value="5"/>
		<property name="idleConnectionTestPeriod" value="60"/>
	</bean>
	
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref bean="dataSource" />
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.MySQL5Dialect
				</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.use_sql_comments">false</prop>
				<!-- 自动生成数据库表
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				-->
			</props>
		</property>
		<property name="mappingResources">
			<list>
				<value>com/shopping/pojo/Resource_goods.hbm.xml</value>
				<value>com/shopping/pojo/Good_user.hbm.xml</value>
				<value>com/shopping/pojo/Goods_order.hbm.xml</value>
				<value>com/shopping/pojo/Datiel_order.hbm.xml</value>
				<value>com/shopping/pojo/Good_car.hbm.xml</value>
				<value>com/shopping/pojo/Goods_comment.hbm.xml</value>
			</list>
		</property>
	</bean>
	<bean id="GoodsUserDAO" class="com.shopping.dao.GoodUserDAO" scope="singleton">
		<property name="sessionFactory" ref="sessionFactory"/>
	</bean>
	<bean id="GoodUserBIZ" class="com.shopping.biz.GoodUserBIZ" scope="prototype">
		<property name="goodUserDao" ref="GoodsUserDAO"/>
	</bean>
	
	<bean id="checkLoginBean" class="com.shopping.action.LoginAction" scope="prototype">
		<property name="goodUserBiz" ref="GoodUserBIZ"/>
	</bean>
	
	<bean id="GoodsDAO" class="com.shopping.dao.GoodsDAO" scope="singleton">
		<property name="sessionFactory" ref="sessionFactory"/>
	</bean>
	
	<bean id="GoodsBIZ" class="com.shopping.biz.GoodsBIZ" scope="prototype">
		<property name="goodsDAO" ref="GoodsDAO"/>
	</bean>
		
	<bean id="showGoodsBean" class="com.shopping.action.GoodsAction" scope="prototype">
		<property name="goodsBIZ" ref="GoodsBIZ"/>
	</bean>
	
	<bean id="CarDAO" class="com.shopping.dao.CarDAO" scope="singleton">
		<property name="sessionFactory" ref="sessionFactory"/>
	</bean>
	
	<bean id="CarBIZ" class="com.shopping.biz.CarBIZ" scope="prototype">
		<property name="carDao" ref="CarDAO"/>
		<property name="goodsDao" ref="GoodsDAO"/>
		<property name="userDao" ref="GoodsUserDAO"/>
	</bean>
	
	<bean id="CarBean" class="com.shopping.action.CarAction" scope="prototype">
		<property name="carBiz" ref="CarBIZ"/>
	</bean>
	
	<bean id="orderDAOBean" class="com.shopping.dao.OrderDAO" scope="prototype">
		<property name="sessionFactory" ref="sessionFactory"/>
	</bean>
	
	<bean id="orderBIZBean" class="com.shopping.biz.OrderBIZ" scope="prototype">
		<property name="orderDao" ref="orderDAOBean"/>
		<property name="userDao" ref="GoodsUserDAO"/>
		<property name="carDao" ref="CarDAO"/>
		<property name="goodsDao" ref="GoodsDAO"/>	
	</bean>
	
	<bean id="orderActionBean" class="com.shopping.action.OrderAction" scope="prototype">
		<property name="orderBiz" ref="orderBIZBean"/>
	</bean>
	
	<bean id="CommentDaoBean" class="com.shopping.dao.CommentDAO" scope="singleton">
		<property name="sessionFactory" ref="sessionFactory"/>
	</bean>
	
	<bean id="CommentBizBean" class="com.shopping.biz.CommentBIZ" scope="prototype">
		<property name="commentDao" ref="CommentDaoBean"/>
		<property name="goodsDao" ref="GoodsDAO"/>
	</bean>
	
	<bean id="CommentActionBean" class="com.shopping.action.CommentAction" scope="prototype">
		<property name="commBiz" ref="CommentBizBean"/>
	</bean>
		
	<!--  -->
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref bean="sessionFactory"/>
		</property>
	</bean>
	
	<!-- 使用基于注解方式配置事务 
	<tx:annotation-driven transaction-manager="transactionManager"/>
	-->
	<tx:advice id="txAdvice" transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="save*"		propagation="REQUIRED"/>
			<tx:method name="add*"		propagation="REQUIRED"/>
			<tx:method name="delete*"	propagation="REQUIRED"/>
			<tx:method name="update*" 	propagation="REQUIRED"/>
			<tx:method name="*" read-only="true"/>
		</tx:attributes>
	</tx:advice>
	<!-- -->
	<aop:config>
    <aop:pointcut id="allManagerMethod" expression="execution(* com.shopping.action.*.*(..))"/>
    <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
    </aop:config>
  
</beans>

 供在其他的项目中参考。

分享到:
评论

相关推荐

    10个必须收藏的PHP代码样例

    header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="filename.ext"'); readfile('path/to/file.ext'); ``` 6. **用Email显示用户的Gravator头像** ...

    android应用程序基础

    - **Content Provider**:用于存储和检索数据,并将这些数据暴露给其他应用程序访问。 - **HelloActivity**示例: - `HelloActivity.java`中定义了一个名为`HelloActivity`的类,该类继承自`Activity`。在`...

    JS 与 JAVA 互相调用代码样例

    'Content-Type': 'application/json', }, body: JSON.stringify({ key1: 'value1', key2: 'value2', }), }) .then(response =&gt; response.json()) .then(data =&gt; { console.log('Data received from Java:', ...

    restful样例代码

    5. **媒体类型(Content-Type)**:通过设置请求头的`Content-Type`字段,指定发送或接收的数据格式,如`application/json`、`application/xml`等。 6. **HATEOAS(Hypermedia as the Engine of Application State...

    JAVA发送HttpClient请求及接收请求完整代码实例

    // 设置请求头(例如Content-Type为application/json) httpPost.setHeader("Content-type", "application/json"); // 执行请求 CloseableHttpResponse response = httpClient.execute(httpPost); try { // ...

    POST实例 模仿post请求

    var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); response.EnsureSuccessStatusCode(); return await response.Content....

    WPF ListView 漂亮样式

    在提供的`WpfApplication1`项目中,你可以看到如何将上述知识点应用到实际的ListView实例中。该项目可能包含了自定义的样式文件(如App.xaml资源字典),以及具体的ListView配置代码。 总的来说,WPF ListView ...

    C#顺丰接口实例

    var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await _httpClient.PostAsync("https://api.sf-express.com/rest/v1/orders", content); if (response....

    WPF原创教程(Homework)——Class4. WPFDataBinding

    WPF的应用程序可以通过XAML(Extensible Application Markup Language)来描述界面元素及其行为,从而实现界面与逻辑的分离。 #### 二、DataBinding的重要性 DataBinding是WPF中的一项核心功能,它允许用户界面...

    Web api之post请求示例代码,亲测可用

    'Content-Type': 'application/json' } }) .then(response =&gt; { console.log('用户创建成功:', response.data); }) .catch(error =&gt; { console.error('创建用户失败:', error.response.data); }); ``` 在实际...

    wpf 按钮 样式

    在WPF中,按钮的样式可以通过XAML(Extensible Application Markup Language)进行定义。样式通常包含颜色、字体、边框、背景、阴影等视觉元素,以及按钮的默认状态、悬停状态、按下状态等交互表现。例如,你可以...

Global site tag (gtag.js) - Google Analytics