spring
共 8 篇文章
基于Annotation和AOP实现Service缓存方案
简单的使用缓存的方法,就是在Service中嵌入调用缓存的代码。 1.先查询缓存, 2.若缓存命中,则返回 3.从数据库查询,并且往缓存中插入一份 这种做法导致许多许多重复代码,所以想到了用注解来调用缓存。并且在注解中设置key和expire 先定义注解 package com.cache; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation…
Study:spring security简单例子
创建一个maven web项目,pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.hisky</groupId> <artifact…
2014-12-12 11:08 · spring · Java · Spring Security
Exception:文件导入的异常
负责排查一个导入功能的bug,debug找到的信息如下: 页面点击导入后,将上传的文件提到到一个controller public ModelAndView importCSV( HttpServletRequest request, HttpServletResponse response ) throws Exception { s_logger.debug("importCSV: importing csv file "); long startTime = System.currentTimeMillis(); String responseText = ImportContacts…
Study:Spring的单例是否只意味着能创建一个实例
<?xml version="1.0" encoding="UTF-8"?> <!-- Bean头部 --> <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:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocat…
2013-06-13 19:02 · spring
Study:SpringMVC3.2处理ajax请求
jsp页面如下: <form id="myForm" method="post" action="/mvc/student/add"> <table> <tr> <td>姓名</td> <td><input id="name" name="name" value="${name}" /></td> </tr> <tr> <td>性別</td> <td>男<input type="radio" name="sex" value="1" />女<input type="radio" name="sex" value="0" /> </td> </tr> <tr> <td>祖籍</td> <td>…
2013-03-25 22:30 · spring · Ajax · json · JSP
Exception:JSP用foreach迭代list时出错,页面解析出错
HTTP ERROR 500 Problem accessing /mvc/student/getList. Reason: The class 'java.lang.String' does not have the property 'studentId'. Caused by: javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'studentId'. at javax.el.BeanELResolver.getBeanProperty(BeanELRe…
2013-03-23 16:15 · spring · JSP · SpringMVC · foreach
Exception:Spring3.2 AOP 事务管理
Spring的配置文件中,事务配置如下: <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" /> <tx:method name="add*" propagation="REQUIRED"/> <tx:method name="delete*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <!…
2013-03-22 19:33 · spring · AOP · Exception · 事务 · 回滚 · sring