Spring
文章平均质量分 65
youchangrui
这个作者很懒,什么都没留下…
展开
-
使用Spring2.5 TestContext框架
一、使用Spring2.5 TestContext框架 参阅:http://www.ibm.com/developerworks/cn/java/j-lo-spring25-test/ Spring 2.5 TestContext 测试框架,是一个全新的基于注解的测试框架,为 Spring 推荐使用该测试框架。 Spring 2.5 相比于 Sprin...原创 2011-06-02 16:52:25 · 75 阅读 · 0 评论 -
Spring FactoryBean 使用
Spring FactoryBean 使用 Entity: package cn.rayoo.spring.factorybean; public class Car { private String brand; private int speed; private Double price; private long id = System...原创 2014-11-27 14:18:40 · 113 阅读 · 0 评论 -
spring xsd usage
http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/xsd-config.html factorybean: <bean id="jacksonFactory" class="com.toon.web.commons.spring.jackson.Jackson...原创 2014-10-14 15:54:11 · 103 阅读 · 0 评论 -
SpringMVC @InitBinder webBindingInitializer
1: 注册Controller内的Binder: @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); dateFormat.setLenient(fal...原创 2015-07-06 15:22:24 · 102 阅读 · 0 评论 -
SpringAOP简单用例
1:Spring配置: <aop:config> <aop:aspect id="LogAspect" ref="logAspectBean"> <aop:pointcut id="aopService" expression="execution(com.xxx.*.xxx.*.service..*.*(..))&qu原创 2015-05-21 15:57:15 · 132 阅读 · 0 评论 -
Spring Hessian
1:服务器端pom.xml <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> &am原创 2014-08-15 19:35:34 · 95 阅读 · 0 评论 -
DelegatingFilterProxy - Spring
参考: http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/web/filter/DelegatingFilterProxy.html 在Spring中,使用下面的代码让Spring代理一个Filter, targetBeanName: 用来指定在Spring上下文中的Bean的名称. 如果不指定...原创 2014-08-07 16:01:50 · 109 阅读 · 0 评论 -
SpringMVC之配置用于@ResponseBody的HttpMessageConverter转换器
<!-- 自动扫描且只扫描@Controller --><mvc:annotation-driven content-negotiation-manager="contentNegotiationManager"><mvc:message-converters><ref bean="bufferedImageHttpMessageConverter"/...原创 2015-01-09 10:38:54 · 376 阅读 · 0 评论 -
SpringMVC之配置内容类型协商管理器
当不希望使用 SpringMVC根据 文件后缀来决定文件类型时,使用内容类型协商管理器进行配置: (应用于406 Not Acceptable错误) <mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" /> <bean id="contentNego...原创 2014-12-31 16:18:13 · 130 阅读 · 0 评论 -
Spring - 属性文件属性注入
在applicationContext.xml中加入: 1:在配置为: <util:properties id="APP_PROPERTIES" location="classpath:application.properties" local-override="true"/> 或: <util:properties id="APP_PROPERTIES"&原创 2013-04-25 09:54:25 · 72 阅读 · 0 评论 -
shiro拦截url动态配置在数据库
核心思想: 1:对 org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.filterChains 执行清空,它维护的是个map.否则原先的没有被覆盖的filterChains还会存在! 2:对org.apache.shiro.web.filter.PathMatchingFilter.appliedPaths执行清空,它维护的...原创 2013-03-28 20:34:59 · 404 阅读 · 0 评论 -
JCaptcha-SpringMVC集成
GMail验证码样式的图片引擎: import java.awt.Color; import java.awt.Font; import java.awt.image.ImageFilter; import com.octo.captcha.component.image.backgroundgenerator.BackgroundGenerator; import com....原创 2013-03-25 11:15:10 · 109 阅读 · 0 评论 -
Spring3.x + Hibernate4.x 升级注意事项
1: 启动服务器发现报:: Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider 这个错误,然后就我就看来一下4.0的core里面没有这个类(我把3.6的core和4.0的core比较了一下有蛮多都不一样了)!已经换成了org.hibernate.cache.spi.RegionFact...原创 2013-03-19 13:23:36 · 148 阅读 · 0 评论 -
SpringMVC中获取request与response对象
1:使用 注解 @Autowired private HttpServletRequest request; 或在方法中public String (HttpServletRequest req,HttpServletResponse resp); 2: 在web点xml中配置一个监听 <listener> <listener-cla...原创 2013-03-18 19:20:07 · 163 阅读 · 0 评论 -
Spring-JDBC/ORM 统一事务管理解决方案
若使用 MyBatis[JDBC] 与hibernate[ORM] 框架结合,且 使用 相同的事务: 解决方案三种: 1: 将JDBC事务打开,且Hibernate事务关闭,再修改 hibernate sessionFactory的 useTransactionAwareDataSource 属性为true <!-- 事务管理器配置, 使用jdbc事务 --&g...原创 2013-03-16 19:43:49 · 206 阅读 · 0 评论 -
使用静态变量缓存ApplicationContext
第一种方法: 1: 声明如下类: package com.rayoo.tech.core.utils.spring; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.sprin...原创 2012-05-09 16:08:32 · 355 阅读 · 0 评论 -
Spring2.5 + Junit测试
要求: JDK1.5以上(因为Junit4是用注解来实现的) 需要的包 spring-2.5.jar junit-4.4.jar spring-test.jar 测试类 package user; import static org.junit.Asse...原创 2011-06-02 17:07:32 · 133 阅读 · 0 评论 -
SpringMVC Freemarker 自定义标签
1:实现 freemarker.template.TemplateMethodModelEx 接口对于 freemarker-2.3.20版本, 更早版本实现freemarker.template.TemplateMethodModel 接口 且加入Spring管理,代码如下: package com.sqtoon.orderserv.web.commons.freemarker.tag;...原创 2014-12-10 18:07:59 · 212 阅读 · 0 评论