@Component
public MyClass{
private MyOtherClass myOtherClass;
@Autowired
public MyClass(MyOtherClass myOtherClass){
this.myOtherClass = myOtherClass;
}
}
@Component
@Scope("prototype")// OR
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE,
proxyMode = ScopedProxyMode.TARGET_CLASS)
public MyOtherClass{
}
I am writing a custom plugin to detect classes which declare variable of type MyOtherClass
and give a warning because MyOtherClass is of type prototype.
I need to get fields from MyClass and need to get Annotations on the field(MyOtherClass) class and need to find if the annotation value contains prototype
.
I am using VariableTree to read the variable but not finding a way to get into variable class metadata.
I can do it on class by using ClassTree.