struts218+mybatis30+spring30全注解小例子Word文档下载推荐.docx
- 文档编号:15759243
- 上传时间:2022-11-15
- 格式:DOCX
- 页数:9
- 大小:17.70KB
struts218+mybatis30+spring30全注解小例子Word文档下载推荐.docx
《struts218+mybatis30+spring30全注解小例子Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《struts218+mybatis30+spring30全注解小例子Word文档下载推荐.docx(9页珍藏版)》请在冰豆网上搜索。
mybatis-spring-1.0.0-RC2.jar
ognl-2.7.3.jar
ojdbc14.jar
org.springframework.aop-3.0.4.RELEASE.jar
org.springframework.asm-3.0.4.RELEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.expression-3.0.4.RELEASE.jar
org.springframework.test-3.0.4.RELEASE.jar
org.springframework.web-3.0.4.RELEASE.jar
slf4j-api-1.5.10.jar
slf4j-log4j12-1.5.10.jar
spring-beans-3.0.4.RELEASE.jar
spring-core-3.0.4.RELEASE.jar
spring-jdbc-3.0.4.RELEASE.jar
spring-tx-3.0.4.RELEASE.jar
struts2-convention-plugin-2.1.8.1.jar
struts2-core-2.1.8.1.jar
struts2-spring-plugin-2.1.8.1.jar
struts-getterAndSetter-plugin.jar
xwork-core-2.1.6.jar
对应的配置文件
applicationContext.xml:
<
beansxmlns="
http:
//www.springframework.org/schema/beans"
xmlns:
xsi="
//www.w3.org/2001/XMLSchema-instance"
xmlns:
jee="
//www.springframework.org/schema/jee"
tx="
//www.springframework.org/schema/tx"
context="
//www.springframework.org/schema/context"
aop="
//www.springframework.org/schema/aop"
xsi:
schemaLocation="
//www.springframework.org/schema/beans
//www.springframework.org/schema/beans/spring-beans-2.5.xsd
//www.springframework.org/schema/tx
//www.springframework.org/schema/tx/spring-tx-2.5.xsd
//www.springframework.org/schema/jee
//www.springframework.org/schema/jee/spring-jee-2.5.xsd
//www.springframework.org/schema/aop
//www.springframework.org/schema/aop/spring-aop-2.5.xsd
//www.springframework.org/schema/context
//www.springframework.org/schema/context/spring-context-2.5.xsd"
default-autowire="
byName"
default-lazy-init="
true"
>
!
--定义受环境影响易变的变量-->
beanclass="
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
propertyname="
locations"
list>
--标准配置-->
value>
classpath:
com/medbri/mss/config/jdbc.properties<
/value>
/list>
/property>
/bean>
--使用annotation自动注册bean,并保证@Required,@Autowired的属性被注入-->
context:
component-scanbase-package="
com.medbri.mss"
/>
--数据源配置,使用应用内的DBCP数据库连接池-->
beanid="
dataSource"
class="
mons.dbcp.BasicDataSource"
destroy-method="
close"
--ConnectionInfo-->
driverClassName"
value="
${jdbc.driver}"
url"
${jdbc.url}"
username"
${jdbc.username}"
password"
${jdbc.password}"
--ConnectionPoolingInfo-->
initialSize"
5"
maxActive"
100"
maxIdle"
30"
maxWait"
500"
defaultAutoCommit"
false"
sqlSessionFactory"
org.mybatis.spring.SqlSessionFactoryBean"
configLocation"
com/medbri/mss/config/mybatis-config.xml"
ref="
--事务管理器配置,单数据源事务-->
transactionManager"
org.springframework.jdbc.datasource.DataSourceTransactionManager"
iUsers"
org.mybatis.spring.MapperFactoryBean"
mapperInterface"
com.medbri.mss.dao.IUsers"
--使用annotation定义事务-->
--<
tx:
annotation-driventransaction-manager="
proxy-target-class="
/>
-->
aop:
configproxy-target-class="
advisorpointcut="
execution(*com.medbri.mss.service..*Service.*(..))"
advice-ref="
txAdvice"
/aop:
config>
adviceid="
attributes>
methodname="
get*"
read-only="
find*"
query*"
is*"
*"
propagation="
REQUIRED"
/tx:
advice>
/beans>
struts.xml
?
xmlversion="
1.0"
encoding="
GBK"
?
DOCTYPEstrutsPUBLIC
"
-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.0//EN"
//struts.apache.org/dtds/struts-2.0.dtd"
struts>
--设置编码-->
constantname="
struts.i18n.encoding"
--与spring集成-->
struts.objectFactory"
spring"
--指定默认的父包-->
struts.convention.default.parent.package"
value="
medbri-default"
--设置convention插件默认的根包-->
strut
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- struts218 mybatis30 spring30 注解 例子
![提示](https://static.bdocx.com/images/bang_tan.gif)