0

I have a class which has a custom scope, which is injected into a singleton scope object by way of the proxyMode scope setting. When debugging in STS or Eclipse I am typically able to view variables and inspect their contents, but this is not the case, as it shows some proxied version of the object.

What is seen in Variables tab:

Name: someClass

Value: SomeClass$$EnhancerBySpringCGLIB$$9c15e764 (id=148)

When unzipping this variable, all of its properties have the value of null, but clicking the variable itself does show an accurate representation of the proxied object's toString() method.

There are many additional properties, such as CGLIB$CALLBACK_{N}, where N is some integer, which seem to lead nowhere concrete when followed and do not seem to show the actual properties of the object someClass.

Question(s):

  1. Is there a missing plugin which enables the viewing of these proxied variables?
  2. Is this user error?
  3. Is there something I can read on this topic, since I don't even know where to begin?

Class Definition:

@Component
@Scope(scopeName = "myCustomScope", proxyMode = ScopedProxyMode.TARGET_CLASS)
public class SomeClass implements Serializable {

Some previous research on the topic which didn't seem to yield helpful results:

Andrew Cotton
  • 415
  • 3
  • 12
  • 1
    I fear you cannot view the content from a proxied class directly. But you can add a breakpoint inside the proxied class if a method within it is called. This should let you get the internal state of the current class instance. – Marcus K. May 11 '18 at 00:27
  • @MarcusK. thank you for your response; I hope you're wrong so that I can find a way, but I too fear that you are correct. Thank you for your time. – Andrew Cotton May 19 '18 at 00:14
  • 1
    I found this article that explains how to retrieve underlying object. It requires reflection. https://www.thekua.com/atwork/2011/06/finding-real-object-under-spring-proxies/ – downeyt Jun 25 '20 at 02:48

0 Answers0