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 ...
随机推荐
- 数据库04 /多表查询、pymysql模块
数据库04 /多表查询.pymysql模块 目录 数据库04 /多表查询.pymysql模块 1. 笛卡尔积 2. 连表查询 2.1 inner join 内连接 2.2 left join 左连接 ...
- Django适当进阶篇
本节内容 学员管理系统练习 Django ORM操作进阶 用户认证 Django练习小项目:学员管理系统设计开发 带着项目需求学习是最有趣和效率最高的,今天就来基于下面的需求来继续学习Django 项 ...
- 小谢第36问:elemet - table表格修改后表格行高亮显示且定位到当前行当前页
第一次做这个需求得时候很乱,总是在表格页和修改页徘徊,总觉得什么都会,但是就是做不出自己想要得效果 其实如果先把思路搞清楚,这个问题得知识点却是不多,以下是我对表格高亮显示得思路: 首先,我会从已知得 ...
- 009.Nginx缓存及配置
一 浏览器缓存 1.1 缓存概述 缓存对于Web至关重要,尤其对于大型高负载Web站点.Nginx缓存可作为性能优化的一个重要手段,可以极大减轻后端服务器的负载.通常对于静态资源,即较少经常更新的资源 ...
- 面试京东T5,被按在地上摩擦,鬼知道我经历了什么?
一转眼间,光阴飞快,各大企业都开始招人,各大学校也开始准备陆续入学. 金三银四已经快结束了,有的朋友发来喜报,面试上了一线大厂,也有没有面试上的朋友跑来跟我说,被虐惨了,几天给大家分享下我一个面试京东 ...
- Python Ethical Hacking - Bypass HTTPS(2)
Injecting Code in HTTPS Pages: #!/usr/bin/env python import re from netfilterqueue import NetfilterQ ...
- CSS3伪元素 ::first-letter ::first-line ::selection
首先,关于伪元素的语法: 有的时候单冒号也能用,但最好写双冒号. 伪类:匹配的是元素(不同状态或结构的). 伪元素:匹配的是元素中的一部分内容(首字符,首行文本). ::first-letter 匹配 ...
- 谷歌浏览器又隐藏的HTTPS和WWW前缀
谷歌工程师 Emily Schechter 曾在 Chromium 反馈页面中提到:Chrome 团队一直将简易性.可用性.安全性作为衡量 UI 的标准.为了让 URL 能更好地被用户理解.移除那些容 ...
- MySQL的权限赋予
MySQL 赋予用户权限命令的简单格式可概括为:grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删除 数据库中所有表数据的权利. grant selec ...
- Go操作腾讯云COS对象存储的简单使用案例
准备环境 安装Go环境 Golang:用于下载和安装 Go 编译运行环境,请前往 Golang 官网进行下载 安装SDK go get -u github.com/tencentyun/cos-go- ...