提交 44e96652 编写于 作者: A ascrutae

[Agent] modify the method matcher of spring bean

上级 f377c335
# Spring Annotation Plugin (Optional)
Date: 2018/01/24
## Purpose
Because of multiple project are used
Spring annotation plugin is an Optional plugin, the plugin
and if you want to active the plugin, you should move the plugin jar to the plugins folder.
The plugin will intercept all public method in the classs annotation with the following annotation.
1. `@Bean`
2. `@Service`
3. `@Componet`
4. `@Repository`
## Purpose
......@@ -24,7 +24,10 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterc
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import static net.bytebuddy.matcher.ElementMatchers.isDeclaredBy;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.not;
public abstract class AbstractSpringBeanInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.spring.annotations.SpringAnnotationInterceptor";
......@@ -37,7 +40,7 @@ public abstract class AbstractSpringBeanInstrumentation extends ClassInstanceMet
return new InstanceMethodsInterceptPoint[] {
new InstanceMethodsInterceptPoint() {
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
return isPublic();
return isPublic().and(not(isDeclaredBy(Object.class)).and(not(named("getSkyWalkingDynamicField"))).and(not(named("setSkyWalkingDynamicField"))));
}
@Override public String getMethodsInterceptor() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册