Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice中获取ClassLoader很麻烦 #161

Closed
oldmanpushcart opened this issue Apr 11, 2019 · 2 comments
Closed

Advice中获取ClassLoader很麻烦 #161

oldmanpushcart opened this issue Apr 11, 2019 · 2 comments
Assignees

Comments

@oldmanpushcart
Copy link
Collaborator

在现有的Advice中获取ClassLoader非常麻烦,必须

final Class<?> classOfHttpServletResponse = advice.getBehavior()
    .getDeclaringClass()
    .getClassLoader()
    .loadClass("javax.servlet.http.HttpServletResponse");

但ClassLoader一直都在,所以希望Advice能Release出获取ClassLoader的方法

@dadiyang
Copy link
Contributor

dadiyang commented Apr 11, 2019

直接在 Advice 对象添加这个方法,可以不?

    /**
     * 获取目标对象的类加载器
     *
     * @return 目标对象的类加载器
     */
    public ClassLoader getTargetClassLoader() {
        return behavior.getDeclaringClass().getClassLoader();
    }

@oldmanpushcart
Copy link
Collaborator Author

1.2.2版本解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants