Spr ing comparison of Spring AOP and AspectJ AOP is simpler than using full AspectJ, because it does not require the introduction of AspectJ compiler / weaver into your development and build processes. If you only need to perform an operation on a Spring bean notice, then Spring AOP is the right choice. If you need to notify the domain object or any other object is not managed by the Spring container, then you need to use AspectJ. If you want to notice the connection point in addition to the simple method of performing outside glamour living (such as: call connection points, field get or set the connection points, etc.), but also need to use AspectJ. XML style = adopts declaration forms to achieve using Spring AOP AspectJ annotation style = Spring glamour living AOP previously realized in the form of a two Bowen wrote, describing the XML style and style using AspectJ example, glamour living are interested can take a look: XML Style: http: // xtu-xiaoxin.iteye.com/admin/blogs/630787 AspectJ style: http://xtu-xiaoxin.iteye.com/blog/630206 1. First of all, support for annotation in Java5 later version, so if you use the JVM java5 version below, do not consider, you must choose the style XML (XML configuration form), rather than the comment form (AspectJ style) of. 2. Using the XML style, all facets, cut-off point, notice and other configurations are written in one or several Spring configuration file. The advantage is that the configuration file, you can very clearly see the system in which section, an aspect using the cut-off point that notification (advice) and notification (advice) role. In AspectJ style in java program glamour living section identifies the clutter and obscure. Use the comment form under what circumstances AOP? Or use annotations to achieve AOP What are the advantages of it? 1. XML style AOP only supports "singleton" aspect instantiation model, while the use of AspectJ AOP style is not the limit. 2.XML style of AOP is not supported by a statement naming the connection point, and the use of AspectJ AOP style is not the limit. Look at the following examples glamour living do not understand the code: InAspectJ style, we can write the following contents:Pointcut (execution (* get * ())) public void propertyAccess () {}Pointcut (execution (org.xyz.Account + * (..)) public void operationReturningAnAccount () {}Pointcut (propertyAccess () && operationReturningAnAccount ()) public glamour living void accountPropertyAccess () {} In the XML style, we can not use '&&' characters to connect to a named connection points, as follows : <aop: pointcut id = "propertyAccess" expression = "execution (* get * ())" /> <aop: pointcut id = "operationReturningAnAccount" expression = "execution (org.xyz.Account + * (..))" ! /> <- wrong configuration -> <aop: pointcut id = "accountPropertyAccess" expression = "propertyAccess && operationReturningAnAccount" /> Note: XML style AOP although why he did not name the connection point of the statement, however, you can use the following form processing , the following configuration: <aop: pointcut id = "propertyAccess" expression = "execution (* get * ())" /> <aop: pointcut id = "operationReturningAnAccount" expression = "execution (org.xyz.Account + * (.. )) "/> <aop: pointcut id =" accountPropertyAccess "expression =" execution (* get * ()) and execution (org.xyz.Account + * (..)) "/> here use two kinds of AOP in Spring different configurations made a simple comparison, we hope to be of some use.
You are not logged in. Please login to comment on the latest comments northwzh: as landlord of the assignment process glamour living state can append introduction? JAVA thread pool (ThreadPoolExecutor) source code analysis dahu1128: SingleThreadExecutor but parallel threads can work either ... JAVA thread pool thread pool as well as several types of principles introduced makefu: / ** * runState provides ... JAVA thread pool of the shutdown and shutdownNow difference free_flurry: corePoolSize not the maximum number of threads is minimal, such as you say, ... JAVA thread pool (ThreadPoolExecutor) source code analysis RonQi: gof95 miaow wrote wrote wrote potian point finale ... wait any longer complain
No comments:
Post a Comment