zalando / problem

A Java library that implements application/problem+json
https://zalando.github.io/problem
MIT License
891 stars 83 forks source link

Spring Framework 6 (Spring Boot 3) support #437

Closed Crovitz closed 1 year ago

Crovitz commented 1 year ago

Due to the release of the new Spring Boot 3, there is a need for zalando problem support.

Detailed Description

I'm trying invoke some requests which should be handled by Advice Trail but I receive when I want to return http 404:

java.lang.NoSuchMethodError: 'org.springframework.http.ResponseEntity$BodyBuilder org.springframework.http.ResponseEntity.status(org.springframework.http.HttpStatus)'
    at org.zalando.problem.spring.web.advice.AdviceTrait.lambda$create$0(AdviceTrait.java:133) ~[problem-spring-web-0.27.0.jar:na]

On Spring Boot 2.x.x version everything works as expected.

Possible Implementation

I'm not sure if it will be easy to handle it, because Spring Framework 6 base on Jakarta instead of Javax and there were be some relevant changes.

Your Environment

hantsy commented 1 year ago

Spring 6 includes a built-in Problem Details implementation. Hope this project will fill some blank of the official exception handler, eg. better Bean validation handling etc.

MALPI commented 1 year ago

Hey @hantsy thanks for your response. Do you have any particular suggestions?

Crovitz commented 1 year ago

@MALPI your:

HJK181 commented 1 year ago

Any updates on this? Our migration to Spring Boot 3 is blocked as we use zalando problem in all our modules ...

Crovitz commented 1 year ago

Spring Boot 3 has their own implementation of the RFC7323, you have to adapt Spring's implementation.

hantsy commented 1 year ago

Hey @hantsy thanks for your response. Do you have any particular suggestions?

Refactor to use Spring built-in Problem APIs, add the missing part in the Spring Boot, such as Bean validation error collection, security exception improvement.

Of course, starting a new project for this is also OK.

MALPI commented 1 year ago

Hey,

First of all, I think this issue is a duplicate of https://github.com/zalando/problem-spring-web/issues/817.

In addition we released https://github.com/zalando/problem-spring-web/releases/tag/0.29.1 which is supporting Spring Boot 3.

I would therefore close the issue for now.

In case anything is unclear please let me know.

Best,

Malte

hantsy commented 1 year ago

@MALPI It is based on the Spring 6 Problem APIs?