I'm also migrating to Spring Boot 3. This worked for me:
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.Closeable;
import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;
import java.io.IOException;
@WebFilter(urlPatterns = {"/*" })
public class ObjectifyWebFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
Filter.super.init(filterConfig);
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
// Per Jeff's suggestion, this is from ObjectifyFilter
try (Closeable closeable = ObjectifyService.begin()) {
chain.doFilter(request, response);
}
}
@Override
public void destroy() {
Filter.super.destroy();
}
}