SPRING in ACTION 4th Edition notes-fourth chapter aspect-oriented spring-009-with Parameters ADVICE2 configuration file is XML

Source: Internet
Author: User

One

1. When the configuration file is XML, the slice class does not write AOP anotation

1  PackageCom.springinaction.springidol;2 3  Public classMagicianImplementsMindReader {4   PrivateString Thoughts;5 6    Public voidInterceptthoughts (String thoughts) {7SYSTEM.OUT.PRINTLN ("Intercepting volunteer ' s Thoughts");8      This. Thoughts =thoughts;9   }Ten  One    PublicString getthoughts () { A     returnthoughts; -   } -}

2.

1<?xml version= "1.0" encoding= "UTF-8"?>2<beans xmlns= "Http://www.springframework.org/schema/beans"3Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"4xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"5Xsi:schemalocation= "Http://www.springframework.org/schema/beans6http//www.springframework.org/schema/beans/spring-beans.xsd7http//WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP8http//www.springframework.org/schema/aop/spring-aop.xsd ">9 Ten<bean id= "Volunteer" One       class= "Com.springinaction.springidol.Volunteer"/> A<bean id= "Magician" -       class= "Com.springinaction.springidol.Magician"/> -    the<!--<start id= "Mindreading_aspect"/>--> -<aop:config> -<aop:aspect ref= "Magician" > -<aop:pointcut id= "thinking" +expression= "Execution (* - com.springinaction.springidol.Thinker.thinkOfSomething (String)) +and args (thoughts) "/> A            at<Aop:before -Pointcut-ref= "thinking" -Method= "Interceptthoughts" -arg-names= "Thoughts"/> -</aop:aspect> -</aop:config> in<!--<end id= "Mindreading_aspect"/>--> -  to</beans>

SPRING in ACTION 4th Edition notes-fourth chapter aspect-oriented spring-009-with Parameters ADVICE2 configuration file is XML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.