CGlib in java

http://jexp.ru/index.php/Java_Tutorial/Spring/MethodInterceptor
https://javax0.wordpress.com/2016/01/20/java-dynamic-proxy/

Bạn đã từng nghĩ về AOP trong Spring

Làm thế nào nó hoạt động được

hoặc bạn từng nghĩ viết hàm loging cho method một class nào đó mà không cần sửa class đó

hãy nghĩ tới CGlib


ví dụ bạn có một class như bên dưới và có 2 methods

public class PersonService {
    public String sayHello(String name) {
        return "Hello " + name;
    }

    public Integer lengthOfName(String name) {
        return name.length();
    }
}


Comments

Popular posts from this blog

Fixing the DeepSpeed Import Error While Fine-Tuning the Qwen Model

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

How to create ISM policy and rotate logs in opensearch