Skip to content

Commit

Permalink
Add documentation to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
fabapp2 committed Dec 13, 2023
1 parent 2967fe0 commit f273f99
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
= Atomic Upgrade to Boot 3

This example shows how to implement a simple Boot application that uses `spring-rewrite-commons` to apply a recipe that upgrades a given Spring application (<3.1) to Spring Boot 3.1.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
@SpringBootApplication
public class SpringBoot3Upgrade implements CommandLineRunner {

public static final String RECIPE_NAME = "org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1";

public static void main(String[] args) {
SpringApplication.run(SpringBoot3Upgrade.class, args);
}
Expand Down Expand Up @@ -87,9 +89,8 @@ public void run(String... args) throws Exception {
ProjectResourceSet projectResourceSet = projectResourceSetFactory.create(baseDir, sourceFiles);

// discover
String recipeName = "org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1";
List<Recipe> recipes = discovery.discoverRecipes();
Optional<Recipe> recipe = recipes.stream().filter(r -> recipeName.equals(r.getName())).findFirst();
Optional<Recipe> recipe = recipes.stream().filter(r -> RECIPE_NAME.equals(r.getName())).findFirst();

// apply
recipe.ifPresent((Recipe r) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= Iterative Upgrade to Boot 3 using PRs

This example shows how to implement a simple Boot application that uses `spring-rewrite-commons` to apply recipes that upgrade the Spring Boot PetClinic from 2.3.x to Spring Boot 3.1 by applying recipes to upgrade from minor to minor version by creating PRs for every recipe run.
No new recipes are applied until the last PR has been merged or closed.

0 comments on commit f273f99

Please sign in to comment.