Skip to content

Commit 560a82c

Browse files
committed
Fix JavaParser supplier in MigrateJaxRsRecipe
1 parent f219382 commit 560a82c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

components/sbm-recipes-jee-to-boot/src/main/java/org/springframework/sbm/jee/jaxrs/MigrateJaxRsRecipe.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
public class MigrateJaxRsRecipe {
4949

5050

51-
private final JavaParser javaParserSupplier = JavaParser.fromJavaVersion().classpath(
52-
ClasspathRegistry.getInstance().getCurrentDependencies()).build();
51+
private final Supplier<JavaParser> javaParserSupplier = () -> JavaParser.fromJavaVersion().classpath(ClasspathRegistry.getInstance().getCurrentDependencies()).build();
5352

5453
@Bean
5554
public Recipe jaxRs(RewriteRecipeLoader rewriteRecipeLoader, RewriteRecipeRunner rewriteRecipeRunner) {
@@ -102,7 +101,7 @@ public Recipe jaxRs(RewriteRecipeLoader rewriteRecipeLoader, RewriteRecipeRunner
102101
JavaRecipeAction.builder()
103102
.condition(HasImportStartingWith.builder().value("javax.ws.rs.core.MediaType").build())
104103
.description("Replace JaxRs MediaType with it's Spring equivalent.")
105-
.recipe(new ReplaceMediaType(() -> javaParserSupplier))
104+
.recipe(new ReplaceMediaType(javaParserSupplier))
106105
.build(),
107106

108107
JavaRecipeAction.builder()
@@ -126,7 +125,7 @@ public Recipe jaxRs(RewriteRecipeLoader rewriteRecipeLoader, RewriteRecipeRunner
126125
JavaRecipeAction.builder()
127126
.condition(HasImportStartingWith.builder().value("javax.ws.rs.core.Response").build())
128127
.description("Replace JaxRs Response and ResponseBuilder with it's Spring equivalent.")
129-
.recipe(new SwapResponseWithResponseEntity(() -> javaParserSupplier))
128+
.recipe(new SwapResponseWithResponseEntity(javaParserSupplier))
130129
.build(),
131130

132131
OpenRewriteDeclarativeRecipeAdapter.builder()
@@ -137,9 +136,9 @@ public Recipe jaxRs(RewriteRecipeLoader rewriteRecipeLoader, RewriteRecipeRunner
137136
.openRewriteRecipe(
138137
"""
139138
type: specs.openrewrite.org/v1beta/recipe
140-
name: org.openrewrite.java.spring.boot3.data.UpgradeSpringData30
141-
displayName: Upgrade to SpringBoot 3.0
142-
description: 'Upgrade to SpringBoot to 3.0 from any prior version.'
139+
name: org.springframework.sbm.jee.MakeRequestParamsOptional
140+
displayName: Set required=false for @RequestParam without 'required'
141+
description: Set required=false for @RequestParam without 'required'
143142
recipeList:
144143
- org.openrewrite.java.AddOrUpdateAnnotationAttribute:
145144
annotationType: "org.springframework.web.bind.annotation.RequestParam"

0 commit comments

Comments
 (0)