Advanced Spring AOP -- source code implementation (2) Advisor and Aspect in Spring AOP, aopadvisor
The example of the complete source code address: https://github.com/yu-linfeng/BlogRepositories/tree/master/repositories/Spring%20AOP%E9% AB %98%E7%BA%A7%E2%80%94%E2%80%94%E6%BA%90%E7%A0%81%E5% AE %9E%E7%8E%B0%EF%BC%882%EF%BC%89Spring%20AOP%E4%B8%AD%E9%80%9A%E7%9F%A5%E5%99%A8%EF%BC%88Advisor%EF%BC%89%E4%B8%8E%E5%88%87%E9%9D%A2%EF%BC%88Aspect%EF%BC%89
Th
OneAspect is the modularity of non-business functions that can recur in different places in the application, such as logs, transactions, security, cachingIn software development, functions. span multiple points of an application isCalled cross-cutting concerns. Typically, these cross-cutting concerns is conceptuallySeparate from (but often embedded directly within) the application ' s business logic.Separating these cross-cutting concerns from the business logic is where
This article mainly introduces how php uses GD to create a height-to-height ratio thumbnail. it involves php's skills in operating images using the GD Library, for more information about how to use GD to create a thumbnail with A aspect ratio, see the example in this article. Share it with you for your reference. The details are as follows:
/*** Create a thumbnail image from $inputFileName no taller or wider than* $maxSize. Returns the new image res
AOP, short for aspect oriented programming, is a continuation of OOP. It is a technology that dynamically and uniformly adds functions to the program without modifying the source code through the pre-compilation method and the dynamic agent at runtime, it looks at the structure of a program from a different perspective than OOP: Oop splits an application {Tagshow (Event)} "> The series is represented as objects of the inheritance relationship. AOP spl
Log statistics using AOP for Aspect-Oriented Programming on the Android platformRecently, I have thought of aop because I need to collect some app logs and don't want to call them everywhere. The procedure is as follows:1. Install the ajdt plug-in eclipse2. Set the cut point and implement the cut point execution method. The configuration in android is slightly different from that in server. The specific code is as follows:
public
();
}
}
}Catch(IOException ioe ){
StringMessage = "IOError. Unable to find Business Unit records ";
Logger. log (SEVERE, message, ioe );
ThrowNewRepositoryException (message, ioe );
}
Logger. log (INFO, "Manager Records returned:" + businessUnits. size ());
ReturnBusinessUnits;
}
The above Code uses FileReader and BUfferedReader to read business data in the CSV file.
The application repeatedly retrieves data from the resource file and then releases it after the operation is complet
Steps for using Spring aspectJ aspect
How to Use aspectJ in spring aop
1: declare a plane:
@ Aspect // side Annotation@ Component // annotation of spring object class instantiationPublic class ErrorLog {// Declare the cut point@ Pointcut (execution (* com. base. user. service .*.*(..)))Public void service (){}
// Execution method;@ AfterThrowing (pointcut = service (), throwing = e)Public void serviceAf
AOP: Aspect-oriented to take the horizontal extraction mechanism, replacing the traditional vertical inheritance system repetitive code (performance monitoring, transaction management, security check, caching)AOP enables the isolation of parts of the business logic, which reduces the coupling between parts of the business logic, improves the reusability of the program, and improves the efficiency of development.Several core concepts of AOP ":1, crossc
notifications
6, MAVEN project must add dependencies
If you do not add the above dependencies, you will most likely test the error.
Implementation mode two, annotated slice
1. Write an original class
Package Com.hsb.beans;
Import org.springframework.stereotype.Repository;
@Repository public
class perform {public
void Show () {
System.out.println ()-Perform.show () ");
}
}
2, write a slice class
Package COM.HSB.AOP;
Import Org.aspectj.lang.ProceedingJoinPoint;
Im
the correct index. It also includes the use of bitmap and function based indexes.
Ensure optimal Join operations: Some queries use nested LOOP join faster, some are hash join faster, others are sort-merge join faster.
These rules seem simple, but they account for 90% of the SQL Tuning task, and they do not need to fully understand the internal workings of Oracle SQL. Here's a quick overview of the following Oracle SQL optimizations.
Let's start with a brief look at Oracle's sort, and see how th
-proxy"type= "Xsd:boolean"default= "false">- xsd:annotation>- xsd:documentation>- indicate that the proxy should is exposed by the AOP framework as a ThreadLocal for retrieval via the Aopconte XT class. Off by default, i.e No. guarantees that Aopcontext access would work. ]]> xsd:documentation> xsd:annotation> Xsd:attribute> Xsd:complextype> xsd:element>1.1 RegistrationOrg.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreatorThe following are th
Detailed examples of Java interceptor and aspect in the application market, java instances
I believe you are familiar with the concepts of interceptor and cut-plane. In this article, we will look at the use of interceptor and cut-plane in the application market.
Use of interceptor: each time before receiving a request, the method in this interceptor will be called. If the preHandle method returns true, it indicates that the corresponding controller wi
One1. When the configuration file is XML, the slice class does not write AOP anotation1 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.123Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"4xmlns:aop= "HTTP
JavaEE ------ ApectJ aspect technology === tag
Currently, one of the most popular aop technologies is ========TagImplementation steps: 1. Import the aop label
Method to open the aop package.
This contains
Then, select the spring version. Configure in the configuration file
As follows:
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xmlns: context = "http://www.springframework.org/schema/context"
Xmlns: tx = "http://www.springframew
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.