- 浏览: 34329 次
- 性别:
- 来自: 成都
最新评论
-
hzs0502030128:
好象不起作用
cxf、struts、spring中web.xml过滤url问题解决方案 -
ndsafhhlk:
方法一很渣,忽略。方法二,很好,我就是用的这个方法方法三,不起 ...
cxf、struts、spring中web.xml过滤url问题解决方案
4.SSH:
5.SSH2:
6.SSJ:
<?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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="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/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "> <!-- 配置数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8"/> <property name="username" value="root"/> <property name="password" value=""/> <!-- 连接池启动时的初始值 --> <property name="initialSize" value="1"/> <!-- 连接池的最大值 --> <property name="maxActive" value="500"/> <!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 --> <property name="maxIdle" value="2"/> <!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 --> <property name="minIdle" value="1"/> </bean> <!-- 配置hibernate的sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"><ref bean="dataSource" /></property> <property name="mappingResources"> <list> <value>com/persia/model/Person.hbm.xml</value> </list> </property> <!-- 1.首先在sessionFactory里面配置以上3条设置 --> <!-- 2.然后得在类路径下面添加一个ehcache.xml的缓存配置文件 --> <!-- 3.最后在要使用缓存的实体bean的映射文件里面配置缓存设置 --> <!--使用二级缓存--> <!-- 不使用查询缓存,因为命中率不是很高 --> <!-- 使用Ehcache缓存产品 --> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.MySQL5Dialect hibernate.hbm2ddl.auto=update hibernate.show_sql=false hibernate.format_sql=false hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=false hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider </value> </property> </bean> <!-- 配置Spring针对hibernate的事务管理器 --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- 配置使用注解的方式来使用事务 --> <tx:annotation-driven transaction-manager="txManager"/> <!-- 使用手工配置的注解方式来注入bean --> <context:annotation-config></context:annotation-config> <!--定义要注入的业务bean --> <bean id="personService" class="com.persia.service.impl.PersonServiceImpl"></bean> <!--将Struts的action交给Spring容器来管理 --> <bean name="/person/list" class="com.persia.struts.PersonListAction"> <!--1.这里要求name和struts-config里面的action的path名称一致,因为id不允许有特殊字符--> <!--2.还得在Struts-config文件里面添加Spring的请求处理器,该处理器会根据action的path属性到Spring容器里面寻找这个bean,若找到了则用这个bean来处理用户的请求--> <!--3.然后去掉action的type标签和值(可选),当Spring处理器找不到该bean时,才会使用Struts的action--> <!--4.最后在action里面使用Spring的注入方式来注入业务bean--> </bean> <bean name="/person/manage" class="com.persia.struts.PersonManageAction"></bean> </beans>
5.SSH2:
<?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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="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/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "> <!-- 配置数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8"/> <property name="username" value="root"/> <property name="password" value=""/> <!-- 连接池启动时的初始值 --> <property name="initialSize" value="1"/> <!-- 连接池的最大值 --> <property name="maxActive" value="500"/> <!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 --> <property name="maxIdle" value="2"/> <!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 --> <property name="minIdle" value="1"/> </bean> <!-- 配置hibernate的sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"><ref bean="dataSource" /></property> <property name="mappingResources"> <list> <value>com/persia/model/Person.hbm.xml</value> </list> </property> <!-- 1.首先在sessionFactory里面配置以上3条设置 --> <!-- 2.然后得在类路径下面添加一个ehcache.xml的缓存配置文件 --> <!-- 3.最后在要使用缓存的实体bean的映射文件里面配置缓存设置 --> <!--使用二级缓存--> <!-- 不使用查询缓存,因为命中率不是很高 --> <!-- 使用Ehcache缓存产品 --> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.MySQL5Dialect hibernate.hbm2ddl.auto=update hibernate.show_sql=false hibernate.format_sql=false hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=false hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider </value> </property> </bean> <!-- 配置Spring针对hibernate的事务管理器 --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- 配置使用注解的方式来使用事务 --> <tx:annotation-driven transaction-manager="txManager"/> <!-- 使用手工配置的注解方式来注入bean --> <context:annotation-config></context:annotation-config> <!--定义要注入的业务bean --> <bean id="personService" class="com.persia.service.impl.PersonServiceImpl"></bean> <!--注入Struts 2的action --> <bean id="personList" class="com.persia.struts2.action.PersonListAction"></bean> </beans>
6.SSJ:
<?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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="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/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "> <!-- 使用手工配置的注解方式来注入bean --> <context:annotation-config></context:annotation-config> <!-- 1.配置Spring集成JPA --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <property name="persistenceUnitName" value="SpringJPAPU"/> </bean> <!--2.配置Spring针对JPA的事务 --> <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <!--3.开启事务注解 --> <tx:annotation-driven transaction-manager="txManager"/> <!--以上3个Spring集成JPA的配置,在web项目先添加Spring支持,后添加JPA支持时会自动生成 --> <!-- 配置业务bean --> <bean id="personService" class="com.persia.service.impl.PersonServiceImpl"></bean> <!-- 配置Struts的action --> <bean name="/person/list" class="com.persia.struts.PersonListAction"/> <bean name="/person/manage" class="com.persia.struts.PersonManageAction"/> </beans>
发表评论
-
cxf、struts、spring中web.xml过滤url问题解决方案
2012-03-02 15:20 5773最近项目遇到webService配置cxf过滤器时与strut ... -
[转]hibernate查询缓存(Query Cache)
2012-02-15 15:43 874转:http://www.lordofthejars.com/ ... -
struts2文件上传下载
2011-10-13 16:09 11021.上传页面 *<form action="对 ... -
[转]hibernate延迟加载机制理解
2011-09-19 19:46 1194[转]http://www.sunxin.org/arti ... -
[转]hibernate3延迟加载
2011-09-19 19:18 989转:百度文库[橙子果冻(343928972)] 延迟加载: 首 ... -
[转]spring依赖注入的3种方式
2011-09-12 19:14 963[转]http://www.pc6.com/infoview/ ... -
[转]Spring配置文件总结(一)
2011-09-12 18:33 834转:http://zhaohe162.blog.163.com ... -
[转]运行时异常与非运行时异常有什么区别
2011-09-12 18:14 950转:http://hi.baidu.com/a72981280 ... -
[转]hibernate.hbm2ddl.auto .
2011-09-05 12:28 1142转:http://blog.csdn.net/kjfcpua/ ... -
声明式spring整合hibernate配置参考
2011-09-05 12:24 880applicationContext.xml <?xml ... -
[转]spring事务原理
2011-09-05 11:56 967转:http://blog.sina.com.cn/s/blo ... -
[转]鸭子-策略模式(Strategy)
2011-09-03 17:08 677转:http://www.cnblogs.com/justin ... -
[转]什么是游离状态
2011-09-03 16:28 858转:http://guocc.iteye.com/blog/6 ... -
[转]一种常用的权限控制算法的实现
2011-09-03 16:24 760转:http://pcedu.pconline.com.c ... -
[转]hibernate延迟加载的原理与实现
2011-09-03 16:20 706转:http://superleo.iteye.com/blo ... -
[转]Spring IoC与AOP的核心思想
2011-09-03 16:14 4706转:http://blog.sina.com.cn/s/blo ...
相关推荐
文件中进行了详细介绍说明这个配置文件是典型XML格式但是它既冗长又不实用对于需要定义大量 Springbeans大工程来说我们难以阅读和管理它 在这篇文章里对于SpringXML配置我将向你展示12种比较好实战其中些实战不仅...
自己总结的spring xml配置的思维导图,包括了spring的基础配置
这是我自己在很多比较成熟的配置文件中提取总结出来的,非常实用和完整的配置文件,自动扫包,做项目时直接复制进去就完全搞定。
在使用Spring,写核心配置文件的时候都引入了不一样的约束,这里总结关于spring的XML约束+Schema约束。以后不管是仅使用ioc功能还是aop,把全部的约束引入即可。至于说如何找到这些约束的代码的过程,也在这个文档...
实践方志鹏博客搭建Springcloud+RabbitMQ+Config-client+config-server Eureka-server的微服务架构,通过/bus/refresh接口触发所有config-client自动从config-server重新读取配置文件。SpringCloud和SpringBoot版本...
传统的Spring做法是使用.xml文件来对bean进行注入或者是...为了解决这两个问题,Spring引入了注解,通过"@XXX"的方式,让注解与Java Bean紧密结合,既大大减少了配置文件的体积,又增加了Java Bean的可读性与内聚性。
4.1 Spring boot 配置文件 6 4.2 配置文件内容 7 4.3属性使用 9 5 . Spring boot 基础包 10 6. spring boot 分解 11 6.1 提供 Spring MVC自动配置 11 6.2 对静态资源的支持 11 6.3 模板引擎 12 6.3.1 ...
Spring.NET是一个应用程序框架,其目的是协助开发人员创建企业级的.NET应用程序。它提供了很多方面的功能,比如依赖注入、面向方面编程(AOP)、数据访问抽象及ASP.NET扩展等等。Spring.NET以Java版的Spring框架为...
├10 4.6 Ribbon-3使用配置文件自定义Ribbon Client.avi ├11 4.7 Ribbon-4 Ribbon脱离Eureka使用.avi ├12 4.8 Feign-1 Feign的简介及基础使用.avi ├13 4.9 Feign-2覆写Feign的默认配置.avi ├14 4.10 Fegion-3...
当创建一个对象的时候,它会用Struts2配置文件中的class属性去和Spring配置文件中的id属性进行关联,如果能找到,则由Spring创建,否则由Struts 2框架自身创建,然后由Spring来装配。Spring插件具体有如下几个作用:...
八、创建spring的配置文件 九、创建测试类 十、总结 将 MyBatis与 Spring 进行整合,主要解决的问题就是将 SqlSessionFactory 对象交由 Spring来管理。所以,该整合,只需要将 SqlSessionFactory 的对象生成器...
2.4 properties配置文件乱码问题 24 2.5 @ConfigurationProperties与@Value的区别 25 2.6 配置@PropertySource、@ImportResource、@Bean 27 2.7 配置文件占位符 30 2.8 Profile多环境支持 31 2.9 配置文件的加载位置...
2.2 Spring配置文件 7 2.3 Spring API 8 3 Spring基本功能详解 8 3.1 SpringIOC 8 3.2别名Alias 11 别名拓展: 11 3.3 Spring容器内部对象的创建 12 Spring容器内部对象创建拓展: 12 3.3.1使用类构造器实例化(默认...
spring框架技术+第2天+xmind思维导图:生命周期,介绍simple project,打印出构造方法...bean作用域request session globalSession:web项目获取核心配置文件要配置两个地方:spring监听器、spring作用域范围的监听。
具体到各个拦截器的配置,包的导入,遇到的问题总结
因为spring 整合mybatis的过程中, 有好几种整合方式,尤其是数据源那块,经常看到不一样的配置方式,总感觉有点乱,所以今天有空总结下,感兴趣的朋友跟随脚本之家小编一起学习吧
13.8. Spring对分段文件上传(multipart file upload)的支持 13.8.1. 介绍 13.8.2. 使用MultipartResolver 13.8.3. 在表单中处理分段文件上传 13.9. 使用Spring的表单标签库 13.9.1. 配置标签库 13.9.2. form标签 ...
13.8. Spring对分段文件上传(multipart file upload)的支持 13.8.1. 介绍 13.8.2. 使用MultipartResolver 13.8.3. 在表单中处理分段文件上传 13.9. 使用Spring的表单标签库 13.9.1. 配置标签库 13.9.2. form...
这是本人总结的一个SSH框架配置文件,主要是Spring3.0的一个小部分配置文档
2.2.3 类包及Spring配置文件规划 2.3 持久层 2.3.1 建立领域对象 2.3.2 UserDao 2.3.3 LoginLogDao 2.3.4 在Spring中装配DAO 2.4 业务层 2.4.1 UserService 2.4.2 在Spring中装配Service 2.4.3 单元测试 2.5 展现层 ...