I upgraded spring boot from 2.7 to 3.1.11 and java from 11 to 21. I have noticed my app behaving differently without any code changes except for jpa syntax and package changes. I am now getting a stack overflow error because of a recursive JPA that wasn’t happening before the upgrade. I am wonder what did they change in the new version that is causing this.
I have tracked down the issue to this:
”’
public interface AuditEntity {
...
@JsonGetter("lastModifiedBy")
default String getModifyUserName() {
if (getLastModifiedBy() != null)
return getLastModifiedBy().getName();
return null;
}
}”’
”’
public abstract class AbstractAuditable implements AuditEntity {
...
@JsonIgnore
public User getLastModifiedBy() {
return lastModifiedBy;
}
}
”’
Is there anything new in spring boot where it behaves differently with default methods perhaps? We have @JsonIgnore on the class that implements the interface, but it is ignored because the interface calls it by default. Does anyone know of any items around @JsonIgnore where the behavior changed in the newer version of spring boot?
jakarta.servlet.ServletException: Handler dispatch failed: java.lang.StackOverflowError
Caused by: java.lang.StackOverflowError: null