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 ...
随机推荐
- 简单讲解一下http2的多路复用
在 HTTP/1 中,每次请求都会建立一次HTTP连接,也就是我们常说的3次握手4次挥手,这个过程在一次请求过程中占用了相当长的时间,即使开启了 Keep-Alive ,解决了多次连接的问题,但是依然 ...
- scala 数据结构(三):元组Tuple
1 元组Tuple-元组的基本使用 基本介绍 元组也是可以理解为一个容器,可以存放各种相同或不同类型的数据. 说的简单点,就是将多个无关的数据封装为一个整体,称为元组, 最多的特点灵活,对数据没有过多 ...
- mongodb(一):数据库安装,部署(windows)
全手打原创,转载请标明出处:https://www.cnblogs.com/dreamsqin/p/10885038.html,多谢~=.= 安装MongoDB 双击运行msi文件,一直“Next”. ...
- Python并发编程06 /阻塞、异步调用/同步调用、异步回调函数、线程queue、事件event、协程
Python并发编程06 /阻塞.异步调用/同步调用.异步回调函数.线程queue.事件event.协程 目录 Python并发编程06 /阻塞.异步调用/同步调用.异步回调函数.线程queue.事件 ...
- softmax、cross entropy和softmax loss学习笔记
之前做手写数字识别时,接触到softmax网络,知道其是全连接层,但没有搞清楚它的实现方式,今天学习Alexnet网络,又接触到了softmax,果断仔细研究研究,有了softmax,损失函数自然不可 ...
- Nginx to start, restart, shutdown and upgrade
1.start cd usr/local/nginx/sbin ./nginx 2.restart kill -HUP PID #主进程号或进程号文件路径 #或者使用 cd /usr/local/ng ...
- git的撤销、删除和版本回退
目录 备注: 知识点: 查看git仓库的状态 查看历史记录. 版本回退 备注: 本文参考于廖雪峰的博客Git教程.依照其博客进行学习和记录,感谢其无私分享,也欢迎各位查看原文. 知识点: 1.git ...
- 牛客网Java工程师能力评估
感觉很奇怪,出的题做完之后感觉自己没学过Java一样,不过凭借一些做题的技巧和一些记忆,正确率百分之50,排名前百分之30多,记录一下这次的题目,方便我以后进行二次复习吧 1.下面有关JVM内存,说法 ...
- 在linux下修改文件夹机器子文件夹的权限
使用命令:chmod 用法:chmod [选项]... 模式[,模式]... 文件... 或:chmod [选项]... 八进制模式 文件... 或:chmod [选项]... --reference ...
- 《python编程从入门到实践》2.3字符串
书籍<python编程从入门到实践> 2.3字符串 知识模块 print()函数,函数名称突出为蓝色,输出括号内的变量或者字符创. 变量名的命名:尽量小写字母加下划线并且具有良好的描述性, ...