spring 3.0 aop instance

2010-04-11  来源:本站原创  分类:Java  人气:396 

Spent an afternoon finally debugged, and made up to be a memorial.
Needed jar
Import all the jar inside the dist
From the outside looking jar Total 5:
aspectjrt.jar (download aspectj install, copy the path from lib)
aspectjweaver.jar (download aspectj install, copy the path from lib)

package com.aabnn.entity;

public interface Person {
        public void readBook(String book);
package com.aabnn.entity;

public class Chinese implements Person{

        public void readBook(String book) {
                // TODO Auto-generated method stub
                System.out.println("I am reading a new book,the book name is:"+book);

package com.aabnn.aspect;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;

public class LogAspect {
        @After("execution(* *.*.*.*.*(..))")
        public void logTest(){
                System.out.println("executing aop testing...");
package com.aabnn.test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.aabnn.entity.Person;

public class SpringTwoTest {

         * @param args
        public static void main(String[] args) {
                // TODO Auto-generated method stub
                ApplicationContext ctx=new ClassPathXmlApplicationContext("ApplicationContext.xml");
                Person p=(Person)ctx.getBean("chinesePerson");
                p.readBook("spring aop");


[code type="xml"]
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    <context:component-scan base-package="com.aabnn.*">
        <context:include-filter type="annotation"
           expression="org.aspectj.lang.annotation.Aspect" />
  • spring 3.0 aop instance 2010-04-11

    Spent an afternoon finally debugged, and made up to be a memorial. Needed jar Import all the jar inside the dist From the outside looking jar Total 5: commons-logging-1.1.1.jar aspectjrt.jar (download aspectj install, copy the path from lib) aspectjw

  • Spring 2.0 AOP and transaction configuration breakthrough 2010-04-29

    One highlight of Spring 2.0 AOP AspectJ-style configuration. But we must by contrast, can see the 2.0-based AOP configuration is to jump out of a new sky. 1. Comparison Look at the 1.0 standard services configuration: <bean abstract="true">

  • Struts2.2 Hibernate3.0 Spring 3.0.3 instance (JAR) 2010-10-23

    package demo.action; import org.springframework.beans.factory.annotation.Autowired; import com.opensymphony.xwork2.ActionSupport; import demo.service.DemoService; /** * QQ:30366040 * Demo Test class * @author PC504 * */ public class DemoAction extend

  • AspectJ in Spring 2.0 Integration 2011-04-20

    Reference Note: the original from http://developer.51cto.com/art/200702/40000.htm , for the convenience of my reading, the text format is slightly adjusted. In the Java language, weaving into the section of the way from the point of view, there are t

  • spring2.0 AOP example of non- 2010-07-30

    spring 2.0 aop configuration ---- solve CGLIB2 is not availa (2008-11-06 10:22:03) reproduced Tags: topics for Category: Java Spring 2.0 aop configuration ---- solve Cannot proxy target class because CGLIB2 is not available. Add in the lib cglib-node

  • With Spring 2.0 and AspectJ simplify the enterprise application 2010-04-23

    http://hi.baidu.com/jmugis/blog/item/78d9d60af8fc5b1c94ca6bc7.html Spring: Simple and powerful Spring's goal is to make enterprise application development simple and efficient as possible. Of this theory can be an instance of Spring's JDBC, ORM, JMX,

  • Spring 2.x AOP declarative configuration 2010-08-14

    Example: In the example, we use <aop:config/> configure a section and block target Peoples of SayHello () method, in its implementation before the output message. People new target class package aop.test; public class People ( public String SayHello

  • Integrating AspectJ in Spring 2.0 2011-04-20

    Reference Note: the original from the http://developer.51cto.com/art/200702/40000.htm , for the convenience of my reading, a slight adjustment of text. In the Java language, the way from the weaving section point of view, there are three ways weaving

  • [转]Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注... 2012-10-18

    第一章 Spring更新到3.0之后,其MVC框架加入了一个非常不错的东西--那就是REST.它的开放式特性,与Spring的无缝集成,以及Spring框架的优秀表现,使得现在很多公司将其作为新的系统开发框架.大象根据实际的项目经验,以之前SSH2例子为基础,对其进行一次大改造,详细的为大家讲解如何实现SSM3全注解式的开发. 这次大象将采取两种构建方式,一是很多人喜欢用的MyEclipse,另一个,则是用Eclipse+Maven.这一篇,将主要讲解开发环境设置与Maven构建方式. 1.开发

  • Configure the JPA in Spring 2.0 environment 2010-06-29

    This article provides a simple standalone Spring framework environment, how to step-by-step guide to develop the JPA. JPA specification is the best start EJB 3.0 persistence mechanism to produce, it is recognized as the simple persistence mechanism f

  • Spring framework and AOP Research and Application of Thought 2010-09-29

    Spring framework and AOP Research and Application of Thought Spring AOP framework and the research and application of thought (1) Keywords: Spring AOP Introduction Aspect Oriented Programming (AOP) is more popular in recent years, computer technology

  • Detailed Spring 3.0 Annotation-based dependency injection implementation (transfer) 2010-11-12

    Using the @ Repository, @ Service, @ Controller and @ Component to identify the class as Bean Since Spring 2.0 release, gradually introduced a number of annotations to simplify development of Spring. @ Repository annotation will be among the first to

  • Spring refresher (f) AOP Aspect Oriented Programming <2> 2011-04-19

    The previous chapter we talked about using proxy mode to automatically manage ISpeaker interfaces in the say () method automatically in say () method before and after the addition we get / give gifts methods. But a more comprehensive idea of students

  • Spring 3.0.0 is Now Available (2009-12-16) 2012-03-09

    Spring 3.0.0 is Now Available News and Announcements It's here just in time for the holidays! Arjen Poutsma has just announced that Spring 3.0.0 is now final and Juergen Hoeller has blogged about the features in the release. Download | Documentation

  • Spring 3.0基于事务的单元测试 2013-07-10

    find an useful article about the spring transaction unit test. Spring 学习笔记(1)--Spring 3.0基于事务的单元测试 package com.kkks.jdbc.dao.impl; import org.springframework.context.ApplicationContext; import org.junit.Test; import org.junit.runner.RunWith; import o

  • Spring中的AOP(一)--AspectJ的基本使用 2014-03-13

    AOP(Aspect Orient Programming),也就是面向切面编程,作为面向对象编程的一种补充,当前已经成为一种比较成熟的编程思想,其实AOP问世的时间并不长,甚至在国内的翻译还不太统一(另有人翻译为"面向方面编程").AOP和OOP(Object Orient Programming,面向对象编程)互为补充,OOP将程序分解成各个层次的对象,而AOP则将程序运行过程分解成各个切面.可以这样理解:OOP是从静态角度考虑程序结构,而AOP则从动态角度考虑程序运行过程. 为什

  • Spring中的AOP(三)--基于Annotation的配置方式(一) 2014-03-22

    AspectJ允许使用注解用于定义切面.切入点和增强处理,而Spring框架则可以识别并根据这些注解来生成AOP代理.Spring只是使用了和AspectJ 5一样的注解,但并没有使用AspectJ的编译器或者织入器,底层依然使用SpringAOP来实现,依然是在运行时动态生成AOP代理,因此不需要增加额外的编译,也不需要AspectJ的织入器支持.而AspectJ采用编译时增强,所以AspectJ需要使用自己的编译器来编译Java文件,还需要织入器. 为了启用Spring对@AspectJ切面

  • Spring3.0 AOP 详解 2014-08-28

    一.什么是 AOP. AOP(Aspect Orient Programming),也就是面向切面编程.可以这样理解,面向对象编程(OOP)是从静态角度考虑程序结构,面向切面编程(AOP)是从动态角度考虑程序运行过程. 二.AOP 的作用. 常常通过 AOP 来处理一些具有横切性质的系统性服务,如事物管理.安全检查.缓存.对象池管理等,AOP 已经成为一种非常常用的解决方案. 三.AOP 的实现原理. 如图:AOP 实际上是由目标类的代理类实现的.AOP 代理其实是由 AOP 框架动态生成的一个

  • Step by step learning spring (6) - Annotations AOP examples of the realization of 2010-04-01

    I've just watched the next spring AOP, the next stop and organize knowledge. The following describes the use of AOP in spring are two examples: a way to implement the use of annotations, another way to implement the declaration adopted. These two exa

  • Spring 2.0 integrates struts 1.2 configuration method 2010-04-02

    Spring 2.0 integrates struts 1.2 configuration method Using the IDE: myEclipse Jar package first required to file web-inf lib folder, myEclipse can automatically help you to complete, in which little to say. The first step: In struts-config. Xml conf