Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

4.7 Inject Interceptor


May 14, 2021 JFinal manual



Inject interceptors are interceptors that use parameters when using enhanc or duang method enhancements. Inject can apply AOP completely intrusively to targets.

If the target that needs to be enhanced is in the jar package and the interceptor cannot be configured with Before Annotations, the target in the jar package can be enhanced with the Inject interceptor. Here's an example of a Inject interceptor:

public void injectDemo() {
	// 为enhance方法传入的拦截器称为Inject拦截器,下面代码中的Tx称为Inject拦截器 OrderService service = Enhancer.enhance(OrderService.class, 		Tx.class); service.payment(…);
}

As the second parameter of the Enhanc.enhance() method in the code above, Tx.class is called the Inject interceptor, which allows AOP enhancement of the target without any intrusion.


Inject interceptors are the same level of concept as the Global, Class, and Method-level interceptors mentioned earlier. L ike Class interceptors, Inject interceptors intercept all methods in enhanced targets. Inject interceptors can be thought of as Class-class interceptors, except that they perform order before Class-class interceptors.