Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

void return type in Spring @ExceptionHandler should work without a @ResponseStatus annotation #5392

Closed
hantsy opened this issue Nov 12, 2019 · 5 comments · Fixed by #5395
Closed
Assignees
Labels
area/spring Issues relating to the Spring integration kind/bug Something isn't working
Milestone

Comments

@hantsy
Copy link
Contributor

hantsy commented Nov 12, 2019

I played more examples of exception handling except the ones mentioned in #4042 .

The following exception handling should work.

 @ExceptionHandler(Exception2.class)
 public void handleException2(Exception2 e, HttpServletResponse response) throws IOException {
        response.setHeader("Content-Type", "application/json");
        response.getWriter().write(e.getMessage());
        response.sendError(HttpServletResponse.SC_BAD_REQUEST);
 }

But in the startup stage, Quarkus will complain it should be used with a @ResponseStatus.

@hantsy hantsy added the kind/bug Something isn't working label Nov 12, 2019
@hantsy hantsy changed the title void return type in Spring Exception Handler should work without a @ResponseStatus annotation void return type in Spring @ExceptionHandler should work without a @ResponseStatus annotation Nov 12, 2019
@hantsy
Copy link
Contributor Author

hantsy commented Nov 12, 2019

I have added more exception handlers in my example codes, hope they work when building a real-world Spring application with Quarkus.

@geoand geoand self-assigned this Nov 12, 2019
@geoand
Copy link
Contributor

geoand commented Nov 12, 2019

I'll fix this (hopefully) for 1.0.0.Final.

@geoand geoand added the area/spring Issues relating to the Spring integration label Nov 12, 2019
geoand added a commit to geoand/quarkus that referenced this issue Nov 12, 2019
@geoand
Copy link
Contributor

geoand commented Nov 12, 2019

#5395 should take care of this

gsmet added a commit that referenced this issue Nov 13, 2019
Make @ResponseStatus on a void controller advice method optional
@gsmet gsmet added this to the 1.1.0 milestone Nov 13, 2019
@gsmet gsmet removed the backport? label Nov 14, 2019
@gsmet gsmet modified the milestones: 1.1.0, 1.0.0.Final Nov 14, 2019
ia3andy pushed a commit to dmlloyd/quarkus that referenced this issue Nov 19, 2019
@hantsy
Copy link
Contributor Author

hantsy commented Nov 21, 2019

@geoand Another small issue. https://stackoverflow.com/questions/58966932/httpservletresponse-set-charset-does-not-wok-in-quarkus-undertow

Great work done in 1.0.0.CR2, I think the spring extensions are ready for production now.

@geoand
Copy link
Contributor

geoand commented Nov 21, 2019

Thanks @hantsy , I'll check it out

mmusgrov pushed a commit to mmusgrov/quarkus that referenced this issue Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/spring Issues relating to the Spring integration kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants