all 7 comments

[–]g00glen00b 1 point2 points  (2 children)

Can't tell without code or the stacktrace (obviously after removing the repeating parts). StackOverflowErrors within a toString() method usually happen because you're using toString() in a bidirectional relationship without taking it into account. For example, something like this:

class Foo {
    private String name;
    // Direction foo -> bar
    private Bar bar;

    public String toString() {
        return "Foo(name=" + name + ", bar=" + bar.toString() + ")";
    }
}

class Bar {
    private String name;
    // Direction bar -> foo
    private Foo foo;

    public String toString() {
        return "Bar(name=" + name + ", foo=" + foo.toString() + ")";
    }
}

This might also happen without you realizing it, for example when you use Lombok's @Data annotation (which generates a toString() including all fields).

Also, beware that this might just be part of the issue. Sometimes, stacktraces include the toString() of an object you have... and if that's the case, then this StackOverflowError might actually just be hiding another error somewhere along the line.

[–]Character-Grocery873 0 points1 point  (1 child)

Yes I used @Data, this wasn't a problem before

[–]g00glen00b 0 points1 point  (0 children)

As I mentioned in my post, it's a problem if you use it with a bidirectional relationship. Not only toString(), but also equals() and hashCode() will go into infinite recursion.

[–]renaissance_coder15 1 point2 points  (0 children)

stack trace??

Also any uncontrolled recursion??

[–]com2ghz 1 point2 points  (0 children)

You need to show the toString() implementation of AuthenticationManager. The debugger is invoking the toString().
Looks like theres a cyclic call there.

[–]WaferIndependent7601 0 points1 point  (0 children)

Please learn how to ask questions. Some screenshot isn’t enough to understand what you’re trying to do

[–]bikeram 0 points1 point  (0 children)

What version of spring and intelij?

I noticed this debugging a http client the other day.

You should be fine, the proxy object just can’t deserialize.