SSH全注解-annotation详细配置
- web.xml的配置:
<!--Spring的装载器 -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!--spring的应用上下文,这里也可以用classpath:appli...xml -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param> <!-- struts2文件拦截器 --> <filter>
<filter-name>struts2</filter-name>
<filter-class>xx.servlet.web.MyStrutsFilterDispatcher</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>xx.bean,xx.dao,xx.quanxin.action</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
- applicationContext.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:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" default-autowire="byType"> <SPAN style="WHITE-SPACE: pre"> <context:annotation-config/>
<context:component-scan base-package="*" /> <aop:aspectj-autoproxy /> <tx:annotation-driven transaction-manager="transactionManager" /> </SPAN> <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"></bean> <bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/systeminfo.properties</value>
</property>
</bean> <!-- DBCP数据库连接数据源的配置 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <!-- 把连接重新放到连接池里 -->
<!-- 添加连接池属性 -->
<property name="driverClassName" value="${DB.driverClassName}"/>
<property name="url" value="${DB.server}"/>
<property name="username" value="${DB.username}"/>
<property name="password" value="${DB.password}"/>
<property name="initialSize" value="2" /> <!-- 初始连接数 -->
<property name="maxActive" value="50"/> <!-- 连接池最大连接数 -->
<property name="maxIdle" value="20"/> <!-- 最大的可空闲的连接数 -->
<property name="minIdle" value="10"/> <!-- 最小的可空闲的连接数 -->
<property name="logAbandoned" value="true" /> <!-- 超时后打印超时连接错误 -->
<property name="removeAbandoned" value="true" /> <!-- 超时移除连接 -->
<property name="removeAbandonedTimeout" value="300"/> <!-- 超时时间 -->
<property name="maxWait" value="1000"/> <!-- 最大可以等待时间 -->
<property name="defaultAutoCommit" value="true"/> <!-- 自动提交, -->
</bean> <!-- 将dataSource注入到下面的sessionFactory类里 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>xx/bean/UserInfo.hbm.xml</value>
<value>xx/bean/Role.hbm.xml</value>
</list>
</property>
<!--
通配符加载方式,暂未启用 <property name="mappingLocations"> <list>
<value>classpath:/jy/bean/*.hbm.xml</value> </list> </property>
-->
<property name="hibernateProperties"> <!-- 这里是Properties列表 -->
<props>
<prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop>
<prop key="hibernate.show_sql">true</prop> <!-- 显示sql -->
</props> </property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> </beans>
SSH全注解-annotation详细配置的更多相关文章
- Spring框架 全注解annotation不使用配置文件(SpringConfiguration.java类代替) 补充 xml配置文件没有提示解决
全注解不使用配置文件 首先还是倒包 在原有的jar包: 需Spring压缩包中的四个核心JAR包 beans .context.core 和expression 下载地址: https://pan.b ...
- Hibernate基于注解annotation的配置
Annotation在框架中是越来越受欢迎了,因为annotation的配置比起XML的配置来说方便了很多,不需要大量的XML来书写,方便简单了很多,只要几个annotation的配置,就可以完成我们 ...
- SSH全注解开发
web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=&quo ...
- SSH整合之全注解
SSH整合之全注解 使用注解配置,需要我们额外引入以下jar包
- 基于IDEA 最新Spirng3.2+hibernate4+struts2.3 全注解配置 登录
原文 基于IDEA 最新Spirng3.2+hibernate4+struts2.3 全注解配置 登录 首先说说 IDEA 12,由于myeclipse越来越卡,我改用idea12 了,发现其功能强悍 ...
- Spring3+SpingMVC+Hibernate4全注解环境配置
Spring3+SpingMVC+Hibernate4全注解环境配置 我没有使用maven,直接使用Eclipse创建动态Web项目,jar包复制在了lib下.这样做导致我马上概述的项目既依赖Ecli ...
- 基于已构建S2SH项目配置全注解方式简化配置文件
如果还不熟悉s2sh项目搭建的朋友可以先阅读 eclipse环境下基于tomcat-7.0.82构建struts2项目 eclipse环境下基于已构建struts2项目整合spring+hiberna ...
- Bean 注解(Annotation)配置(3)- 依赖注入配置
Spring 系列教程 Spring 框架介绍 Spring 框架模块 Spring开发环境搭建(Eclipse) 创建一个简单的Spring应用 Spring 控制反转容器(Inversion of ...
- Bean 注解(Annotation)配置(2)- Bean作用域与生命周期回调方法配置
Spring 系列教程 Spring 框架介绍 Spring 框架模块 Spring开发环境搭建(Eclipse) 创建一个简单的Spring应用 Spring 控制反转容器(Inversion of ...
随机推荐
- C#学习与个人总结
本学期的C#相对来说,自我学习方法大有收获.但自律性.自我约束能力,我是否达到预期的最好效果,这个很难说出口.本学期在图书馆借了一本MySql.微机原理的书看了看,记了一些笔记.感觉知识有一些相同,有 ...
- mysql语句批量产生大量测试数据
CREATE TABLE `t_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, ` ...
- less基础
less less的含义: less是一种动态样式语言,属于css预处理器的范畴,它扩展了css语言,增加了变量.Mixin.函数等特性,使css更易维护和扩展. 此外,less既可以在客户端上运行, ...
- 循序渐进VUE+Element 前端应用开发(16)--- 组织机构和角色管理模块的处理
在前面随笔<循序渐进VUE+Element 前端应用开发(15)--- 用户管理模块的处理>中介绍了用户管理模块的内容,包括用户列表的展示,各种查看.编辑.新增对话框的界面处理和后台数据处 ...
- bzoj2160拉拉队排练
bzoj2160拉拉队排练 题意: 给一个字符串,求最长的k个回文子串(此处回文子串长度必须为奇数)长度的乘积.字符串长度≤1000000 题解: 先用manacher预处理出第i个字符为中心的最长回 ...
- js获取div对象几何信息
/** * @description 获取对象信息: * bottom: 208 * height: 200 (老版本IE不兼容) * width: 200 (老版本IE不兼容) * left: 8 ...
- 手把手撸套框架-ORM框架的选择
目录 一,为什么选择SqlSugar? 在.net core ORM框架中,能选择的方案其实有很多,包括以下方案: 1,EF-Core 2,Dapper 3,FreeSql 4,SqlSugar 为什 ...
- JAVA 面向对象 三大特征:继承
什么是继承 多个类中存在相同属性和行为时,将这些内容抽取到单独一个类中,那么多个类无需再定义这些属性和行为,只要继承那个类即可. 多个类可以称为子类,单独这个类称为父类.超类或者基类. 子类可以直接访 ...
- 完美解决pycharm 不显示代码提示问题
pycharm 不显示代码提示 1.检查IDE省电模式是否关闭状态!!! file → power save mode 取消掉 2.检查代码提示是否成功开启. setting → Inspection ...
- Nginx 服务器配置支持SignalR (WebSocket)
今天SignalR部署在测试环境服务器前端出现无法连接,前端报错如下: failed: Error during WebSocket handshake: Unexpected response co ...