openrewrite / rewrite-spring

OpenRewrite recipes for Spring projects.
Apache License 2.0
237 stars 64 forks source link

Eureka Server as Springbootapplication running into error #533

Closed Tobias-Pe closed 1 month ago

Tobias-Pe commented 1 month ago

What version of OpenRewrite are you using?

I am using

How are you running OpenRewrite?

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.SpringBoot3BestPractices

What is the smallest, simplest way to reproduce the problem?

Checkout: https://github.com/Tobias-Pe/distributed-systems-energy-efficiency or create a service using erureka spring server

And run mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.SpringBoot3BestPractices

Then the gateway using eureka server as a spring service will not work.

What is the full stack trace of any errors you encountered?

[ERROR] Failed to execute goal org.openrewrite.maven:rewrite-maven-plugin:5.32.1:run (default-cli) on project gateway: Execution default-cli of goal org.openrewrite.maven:rewrite-maven-plugin:5.32.1:run failed: Error while visiting servicediscovery\src\main\java\edu\hm\peslalz\thesis\servicediscovery\ServicediscoveryApplication.java: java.lang.IllegalArgumentException: Failed to retrieve value from the configured constant
[ERROR]   org.openrewrite.java.ReplaceStringLiteralWithConstant.getLiteralValue(ReplaceStringLiteralWithConstant.java:77)
[ERROR]   org.openrewrite.java.ReplaceStringLiteralWithConstant.getVisitor(ReplaceStringLiteralWithConstant.java:110)
[ERROR]   org.openrewrite.java.spring.http.ReplaceStringLiteralsWithMediaTypeConstants$2.preVisit(ReplaceStringLiteralsWithMediaTypeConstants.java:129)
[ERROR]   org.openrewrite.java.spring.http.ReplaceStringLiteralsWithMediaTypeConstants$2.preVisit(ReplaceStringLiteralsWithMediaTypeConstants.java:124)
[ERROR]   org.openrewrite.TreeVisitor.visit(TreeVisitor.java:247)
[ERROR]   org.openrewrite.TreeVisitor.visit(TreeVisitor.java:151)
[ERROR]   org.openrewrite.ScanningRecipe$1.visit(ScanningRecipe.java:112)
[ERROR]   org.openrewrite.ScanningRecipe$1.visit(ScanningRecipe.java:94)
[ERROR]   org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$5(RecipeRunCycle.java:164)
[ERROR]   io.micrometer.core.instrument.AbstractTimer.recordCallable(AbstractTimer.java:175)
[ERROR]   org.openrewrite.table.RecipeRunStats.recordEdit(RecipeRunStats.java:68)
[ERROR]   org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$6(RecipeRunCycle.java:161)
[ERROR]   org.openrewrite.scheduling.RecipeStack.reduce(RecipeStack.java:57)
[ERROR]   org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$7(RecipeRunCycle.java:134)
[ERROR]   org.openrewrite.internal.InMemoryLargeSourceSet.lambda$edit$0(InMemoryLargeSourceSet.java:66)
[ERROR]   org.openrewrite.internal.ListUtils.map(ListUtils.java:176)
timtebeek commented 1 month ago

Thanks for reporting this @Tobias-Pe ; should be fixed in https://github.com/openrewrite/rewrite/pull/4224

I expect a new release by the end of the week; until then you can use our snapshot versions.