Skip to content

Commit f38608e

Browse files
committed
Fix conditoon for PagingAndSortingHelper and use in migration
1 parent 3f478d1 commit f38608e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/PagingAndSortingHelper.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.openrewrite.ExecutionContext;
2121
import org.openrewrite.java.JavaIsoVisitor;
2222
import org.openrewrite.java.tree.J;
23+
import org.springframework.sbm.boot.common.conditions.IsSpringBootProject;
2324
import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportSection;
2425
import org.springframework.sbm.engine.context.ProjectContext;
2526
import org.springframework.sbm.project.resource.RewriteSourceFileHolder;
@@ -42,6 +43,13 @@ public String getDescription() {
4243

4344
@Override
4445
public boolean evaluate(ProjectContext context) {
46+
IsSpringBootProject isSpringBootProject = new IsSpringBootProject();
47+
isSpringBootProject.setVersionPattern("2\\.7\\..*|3\\.0\\..*");
48+
boolean isSpringBootApplication = isSpringBootProject.evaluate(context);
49+
if(!isSpringBootApplication) {
50+
return false;
51+
}
52+
4553
//CrudRepositoryExtension
4654
List<RewriteSourceFileHolder<J.CompilationUnit>> pagingAndSortingFileHolders =
4755
context.getProjectJavaSources().find(pagingAndSortingFinders("org.springframework.data.repository.PagingAndSortingRepository"));

components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/report/sbu30-paging-and-sorting-repository.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
- type: org.springframework.sbm.engine.recipe.OpenRewriteDeclarativeRecipeAdapter
88
condition:
9-
type: org.springframework.sbm.boot.common.conditions.IsSpringBootProject
10-
versionPattern: "2\\.7\\..*|3\\.0\\..*"
9+
type: org.springframework.sbm.boot.upgrade_27_30.report.helper.PagingAndSortingHelper
1110
description: Add CrudRepository interface extension additionally to PagingAndSortingRepository
1211
openRewriteRecipe: |-
1312
type: specs.openrewrite.org/v1beta/recipe

0 commit comments

Comments
 (0)