spring杂谈
苦奢bu咖啡
没有伞的孩子就必须努力奔跑
展开
-
spring aop 测试 切面拦截没有作用
在做aop测试的时候 发现pointcut 没有效果,之后查了一下 发现了问题 如果使用了spring mvc后,如果把<aop:aspectj-autoproxy proxy-target-class="true"/>放在application.xml文件中可能会aop无效,最好把它放在dispatcher-servlet.xml文件中 <?xml ver...原创 2016-07-08 17:20:20 · 936 阅读 · 0 评论 -
获取配置文件property的的value
public class RedProFile { public static void main(String[] a){ String resourceFile = "system"; // 创建一个默认的ResourceBundle对象 // ResourceBundle会查找包system.properties的文件 //...原创 2016-11-07 14:54:48 · 384 阅读 · 0 评论 -
浅谈mybatis核心配置,spring和mybatis 整合
在这两大框架的整合中我们使用mybatis-spring的jar包来整合,因为在spring3 的时候还没有对mybatis的支持,所以这个是mybatis社区自己开发出来的sqlSessionFactory首先我们要知道mybatis是通过sqlsession 在操作的,而sqlSession是SQLSessionFactory在创建出来的,所以我们要在xml中配置一个会话工场 来...原创 2016-09-28 14:19:03 · 164 阅读 · 0 评论 -
java项目 定时任务执行
在项目中经常会用到执行定时任务,下面的两种是我在做项目的时候用到的两种(1)spring task在spring.xml中beans xmlns添加 http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-3.2.xsdhttp://www.sp...原创 2016-09-20 19:38:38 · 377 阅读 · 0 评论 -
linux tomcat服务器 内存溢出(转)
常见的一般会有下面三种情况: 1.OutOfMemoryError: Java heap space 2.OutOfMemoryError: PermGen space 3.OutOfMemoryError: unable to create new native thread. 1.java.lang.OutOfMemoryError: PermGen spacePermGen s...原创 2016-09-19 09:57:28 · 98 阅读 · 0 评论 -
spring-mybatis,xml 事务通知
在mybatis.xml中进行配置, <!-- 启用对事务注解的支持 --><tx:annotation-driven transaction-manager="transactionManager" /><!--事务拦截通知--><tx:advice id="txAdvice" transaction-manager=...原创 2016-09-18 11:25:56 · 223 阅读 · 0 评论 -
自定义exception
package com.wonder.exception;/** * Created by Guozhijie on 2016/9/12. */public class ServiceException extends RuntimeException { protected String msg; protected int code; pu...原创 2016-09-12 20:04:27 · 83 阅读 · 0 评论 -
iintercepter
HandlerInterceptor 拦截基于response为RESTfulMessagepublic class LoginIntercepter implements HandlerInterceptor { public boolean preHandle(javax.servlet.http.HttpServletRequest httpSe...原创 2016-09-12 20:02:56 · 51 阅读 · 0 评论 -
方法拦截的注解
package com.wonder.annos;import com.sun.tools.javac.code.Attribute;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy...原创 2016-09-10 16:32:22 · 112 阅读 · 0 评论 -
spring+springmvc+mybatis+maven 项目搭建代码
开发工具为idea,首先先看下搭建好之后的项目的结构,common-config 为项目环境的配置,因为在开发当中,有本地,测试,预生产,生产,四种环境,这样的package的时候不用修改配置,直接打包就ok 首先我们先建一个object项目,然后在项目中 建一个 Module 名称为 antique再在下面建三个小Moduleantique-api, 主要是service ...原创 2016-09-10 15:03:40 · 312 阅读 · 0 评论 -
mysql 主从复制
简单了配置了下mysql 主从复制首先两台ubuntu机子上都安装了mysql主要的参考资料url 为http://369369.blog.51cto.com/319630/790921/ 记录一下坑的地方 show master status 主数据库 master_log_file master_log_pos 这两个一定要用自己的 且数据库每次重启都会变的Sl...原创 2017-07-03 21:15:42 · 83 阅读 · 0 评论