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.微机原理的书看了看,记了一些笔记.感觉知识有一些相同,有 ...
- java IO流 (二) IO流概述
1.流的分类* 1.操作数据单位:字节流.字符流* 2.数据的流向:输入流.输出流* 3.流的角色:节点流.处理流 图示: 2.流的体系结构 说明:红框对应的是IO流中的4个抽象基类.蓝框的流需要大家 ...
- CSS-好玩的样式(用高斯模糊制作平缓突起)
一.效果图: 应用: 二.上代码 <!DOCTYPE html> <html lang="en"> <head> <meta charse ...
- 从连接器组件看Tomcat的线程模型——连接器简介
Connector组件介绍 Connector(连接器)组件是Tomcat最核心的两个组件之一,主要的职责是负责接收客户端连接和客户端请求的处理加工.每个Connector都将指定一个端口进行监听,分 ...
- MySQL数据库---前言
MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下公司.MySQL 最流行的关系型数据库管理系统,在 WEB 应用方面MySQL是最好的 RDBMS ...
- 题解 洛谷 P5324 【[BJOI2019]删数】
先考虑对于一个序列,能使其可以删空的的修改次数. 首先可以发现,序列的排列顺序是没有影响的,所以可以将所有数放到桶里来处理. 尝试对一个没有经过修改的可以删空的序列来进行删数,一开始删去所有的\(n\ ...
- Dart中final和const关键字
final和const 如果您从未打算更改一个变量,那么使用 final 或 const,不是var,也不是一个类型. 一个 final 变量只能被设置一次,两者区别在于:const 变量是一个编译时 ...
- Java基础(二)流程语句与数组
Java流程语句详解:https://www.cnblogs.com/jiajia-16/p/6008200.html Java数组详解:https://www.cnblogs.com/jiajia- ...
- 使用ASP.NET实现定时计划任务,不依靠windows服务
我们怎样才能在服务器上使用asp.net定时执行任务而不需要安装windows service?我们经常需要运行一些维护性的任务或者像发送提醒邮件给用户这样的定时任务.这些仅仅通过使用Windows ...
- css中使用浮动的情况和清除浮动的方法
1.使用浮动时出现的情况: (1)使块元素在一行显示 (2)使内嵌元素支持宽高 (3)不设置宽高的时候宽度由内容撑开 (4)换行不被解析(故使用行内元素的时候清除间隙的方法可以使用浮动) (5)元素添 ...