diff --git a/components/sbm-support-boot/src/main/java/org/openrewrite/java/spring/SpringBeanDeclarationFinder.java b/components/sbm-support-boot/src/main/java/org/openrewrite/java/spring/SpringBeanDeclarationFinder.java index 185da5cc8..468441286 100644 --- a/components/sbm-support-boot/src/main/java/org/openrewrite/java/spring/SpringBeanDeclarationFinder.java +++ b/components/sbm-support-boot/src/main/java/org/openrewrite/java/spring/SpringBeanDeclarationFinder.java @@ -37,7 +37,12 @@ public String getDisplayName() { } @Override - protected TreeVisitor getVisitor() { + public String getDescription() { + return getDisplayName(); + } + + @Override + public TreeVisitor getVisitor() { return new JavaIsoVisitor<>() { @Override public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, ExecutionContext executionContext) { diff --git a/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyImport.java b/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyImport.java index 0f0b8eea1..51d10fdeb 100644 --- a/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyImport.java +++ b/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyImport.java @@ -52,7 +52,7 @@ private boolean hasBuildFileDependencyImport(BuildFile buildFile) { } private String resolveCoordinates(BuildFile buildFile, Dependency md) { - String coordinates = md.getCoordinates(); + String coordinates = md.getGav(); if (md.getVersion().startsWith("${")) { String version = buildFile.getProperty(md.getVersion().substring(2, md.getVersion().length() - 1)); if (version != null) { diff --git a/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyManuallyManaged.java b/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyManuallyManaged.java index b67d69a12..93a27b6c2 100644 --- a/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyManuallyManaged.java +++ b/components/sbm-support-boot/src/main/java/org/springframework/sbm/boot/common/conditions/HasSpringBootDependencyManuallyManaged.java @@ -56,6 +56,6 @@ public boolean evaluate(ProjectContext context) { @NotNull private Predicate matchesSpringBootPattern() { - return k -> k.getCoordinates().matches("org\\.springframework\\.boot:.*:" + versionPattern); + return k -> k.getGav().matches("org\\.springframework\\.boot:.*:" + versionPattern); } } diff --git a/components/sbm-support-boot/src/test/java/org/springframework/sbm/boot/properties/api/SpringBootApplicationPropertiesTest.java b/components/sbm-support-boot/src/test/java/org/springframework/sbm/boot/properties/api/SpringBootApplicationPropertiesTest.java index 94e21497a..c3ad24bf6 100644 --- a/components/sbm-support-boot/src/test/java/org/springframework/sbm/boot/properties/api/SpringBootApplicationPropertiesTest.java +++ b/components/sbm-support-boot/src/test/java/org/springframework/sbm/boot/properties/api/SpringBootApplicationPropertiesTest.java @@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test; +import org.openrewrite.SourceFile; import org.openrewrite.properties.PropertiesParser; import org.openrewrite.properties.tree.Properties; import org.springframework.sbm.parsers.RewriteExecutionContext; @@ -39,10 +40,17 @@ void createNewProperties_Add_Print() { @Test void parseExistingPropertiesTest() { - List parse = new PropertiesParser().parse( - "foo=bar\n" + - "bob=bill"); - SpringBootApplicationProperties sut = new SpringBootApplicationProperties(Path.of("./projectDir").toAbsolutePath(), parse.get(0), new RewriteExecutionContext()); + List parse = new PropertiesParser() + .parse( + """ + foo=bar + bob=bill + """ + ) + .toList(); + Path absolutePath = Path.of("./projectDir").toAbsolutePath(); + Properties.File propertiesFile = (Properties.File) parse.get(0); + SpringBootApplicationProperties sut = new SpringBootApplicationProperties(absolutePath, propertiesFile, new RewriteExecutionContext()); assertThat(sut.getProperty("foo").get()).isEqualTo("bar"); assertThat(sut.getProperty("bob").get()).isEqualTo("bill"); assertThat(sut.getProperty("jane")).isEmpty();