You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate javax.ws.rs.DefaultValue annotation on request parameters to the defaultValue attribute of org.springframework.web.bind.annotation.RequestParam
Why it needs to be done
javax.ws.rs.DefaultValue is one of the JAX-RS annotations that needs to be migrated to Spring Web. The annotation can be applied to a couple of request annotations like QueryParam, FormParam, PathParam, ... but let's start with QueryParam.
Acceptance Criteria
After applying the recipe, the RequestParam annotation has a defaultValue attribute with the same value as the javax.ws.rs.DefaultValue annotation and the javax.ws.rs.DefaultValue annotation is removed.
Given a method parameter annotated with both javax.ws.rs.DefaultValue and javax.ws.rs.QueryParam annotations When the recipe MigrateJaxRsRecipe is applied Then the method parameter is annotated with a org.springframework.web.bind.annotation.RequestParam having an defaultValue attribute with the same value as the javax.ws.rs.DefaultValue annotation
Additional Information
An example: public String getAllPersons(@DefaultValue("0") @QueryParam("page") int page)
should be migrated to public String getAllPersons(@RequestParam(required = false, value = "page", defaultValue="0") int page)
The text was updated successfully, but these errors were encountered:
Thanks for adding this @bottemav
It's a long way to fully migrate JAX-RS to Boot...
would you like to look into it and contribute something as another step in this direction?
I like the idea of implementing a generic recipe.
IMHO it should be an isolated step and not combined with deleting the recipe.
Mainly because I could imagine a composition of these recipes where multiple annotation attributes need to be moved and then you wouldn't want to delete the annotation straight away but do it in a separate step.
A quick check made me realize a DeleteAnnotaion does not exist.
I am more than open to discussing in case you have a different opinion.
I will assign this issue to you. Thanks for contributing 🚀
What needs to be done
Migrate
javax.ws.rs.DefaultValue
annotation on request parameters to thedefaultValue
attribute oforg.springframework.web.bind.annotation.RequestParam
Why it needs to be done
javax.ws.rs.DefaultValue is one of the JAX-RS annotations that needs to be migrated to Spring Web. The annotation can be applied to a couple of request annotations like QueryParam, FormParam, PathParam, ... but let's start with QueryParam.
Acceptance Criteria
After applying the recipe, the RequestParam annotation has a
defaultValue
attribute with the same value as thejavax.ws.rs.DefaultValue
annotation and thejavax.ws.rs.DefaultValue
annotation is removed.Given a method parameter annotated with both
javax.ws.rs.DefaultValue
andjavax.ws.rs.QueryParam
annotationsWhen the recipe MigrateJaxRsRecipe is applied
Then the method parameter is annotated with a
org.springframework.web.bind.annotation.RequestParam
having andefaultValue
attribute with the same value as thejavax.ws.rs.DefaultValue annotation
Additional Information
An example:
public String getAllPersons(@DefaultValue("0") @QueryParam("page") int page)
should be migrated to
public String getAllPersons(@RequestParam(required = false, value = "page", defaultValue="0") int page)
The text was updated successfully, but these errors were encountered: