Skip to content

Commit 35ed9ef

Browse files
committed
WIP
1 parent 09b218d commit 35ed9ef

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

applications/rest-service/src/main/java/org/springframework/sbm/ReportController.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class ReportController{
3838
@Autowired
3939
private ProjectContextHolder contextHolder;
4040

41+
private final String REPORT_RECIPE = "sbu30-report";
42+
4143
@GetMapping(path = "/spring-boot-upgrade", produces = MediaType.TEXT_HTML_VALUE)
4244
@ResponseBody
4345
public String upgrade() {
@@ -48,34 +50,18 @@ public String upgrade() {
4850
@PostMapping(path = "/spring-boot-upgrade", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.TEXT_HTML_VALUE)
4951
@ResponseBody
5052
public String applyRecipes(@RequestParam("recipeNames[]") String[] recipeNames) {
51-
/*
5253
ProjectContext context = contextHolder.getProjectContext();
5354
List.of(recipeNames).forEach(recipeName -> applyCommand.execute(context, recipeName));
54-
applyCommand.execute(context, "boot-2.7-3.0-upgrade-report2");
55-
56-
*/
57-
try {
58-
Thread.sleep(5000);
59-
} catch (InterruptedException e) {
60-
throw new RuntimeException(e);
61-
}
55+
applyCommand.execute(context, REPORT_RECIPE);
6256
return reportHolder.getReport();
6357
}
6458

6559
@PostMapping(path = "/spring-boot-upgrade")
6660
@ResponseBody
6761
public void applyRecipes2(@RequestBody String recipeNames) {
68-
/*
6962
ProjectContext context = contextHolder.getProjectContext();
7063
List.of(recipeNames).forEach(recipeName -> applyCommand.execute(context, recipeName));
71-
applyCommand.execute(context, "boot-2.7-3.0-upgrade-report2");
72-
73-
*/
74-
try {
75-
Thread.sleep(5000);
76-
} catch (InterruptedException e) {
77-
throw new RuntimeException(e);
78-
}
64+
applyCommand.execute(context, REPORT_RECIPE);
7965
}
8066

8167
}

applications/rest-service/src/main/java/org/springframework/sbm/SpringBootMigratorRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class SpringBootMigratorRunner implements ApplicationRunner {
3131
private final ScanCommand scanCommand;
3232
private final ProjectContextHolder contextHolder;
3333
private final ApplyCommand applyCommand;
34+
private final String REPORT_RECIPE = "sbu30-report";
3435

3536
@Override
3637
public void run(ApplicationArguments args) {
@@ -42,7 +43,7 @@ public void run(ApplicationArguments args) {
4243
System.out.println("Scanning " + applicationPath);
4344
ProjectContext context = scanCommand.execute(applicationPath);
4445
contextHolder.setProjectContext(context);
45-
applyCommand.execute(contextHolder.getProjectContext(), "boot-2.7-3.0-upgrade-report2");
46+
applyCommand.execute(contextHolder.getProjectContext(), REPORT_RECIPE);
4647
System.out.println("finished scan. Please open: http://localhost:8080/spring-boot-upgrade");
4748
}
4849

components/sbm-core/src/main/java/org/springframework/sbm/engine/recipe/SbmRecipeLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@RequiredArgsConstructor
3232
public class SbmRecipeLoader implements RecipeLoader {
3333

34-
static final String PATTERN = "classpath*:/recipes/*";
34+
static final String PATTERN = "classpath*:/recipes/**/*.yaml";
3535
private final RecipeParser recipeParser;
3636
private final ResourceHelper resourceHelper;
3737

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ private String renderRemediation() {
241241
sb.append(remediation.getDescription()).append(ls).append(ls);
242242
if(remediation.getPossibilities().isEmpty()) {
243243
renderResourcesList(sb, remediation);
244+
renderRecipeButton(sb, remediation.getRecipe());
244245
} else {
245246
remediation.getPossibilities().forEach(p -> renderRemediationPossibility(sb, p));
246247
}
@@ -251,8 +252,11 @@ private void renderRemediationPossibility(StringBuilder sb, RemediationPossibili
251252
sb.append("===== ").append(p.getTitle()).append(ls);
252253
sb.append(p.getDescription()).append(ls).append(ls);
253254
renderResourcesList(sb, p);
255+
renderRecipeButton(sb, p.getRecipe());
256+
}
254257

255-
if(p.getRecipe() != null) {
258+
private void renderRecipeButton(StringBuilder sb, String recipe) {
259+
if(recipe != null && !recipe.isEmpty()) {
256260
sb.append(ls).append(ls);
257261
/*
258262
<!--
@@ -275,10 +279,9 @@ private void renderRemediationPossibility(StringBuilder sb, RemediationPossibili
275279
</div>
276280
++++
277281
""";
278-
buttonCode = buttonCode.replace("<RECIPE>", p.getRecipe());
282+
buttonCode = buttonCode.replace("<RECIPE>", recipe);
279283
sb.append(buttonCode);
280284
}
281-
282285
}
283286

284287
private void renderResourcesList(StringBuilder sb, ResourceList p) {

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@
8585
This section lists the changes SBM found to be applicable to upgrade the scanned application to Spring Boot 3.0.0.
8686
8787
sections:
88+
- title: Add Spring Boot dependency and plugin milestone repository
89+
helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.MissingHelper
90+
change: |-
91+
As currently only milestone releases exist these are required
92+
affected: |-
93+
You want to update to 3.0 so you're affected
94+
remediation:
95+
description: |-
96+
Add Spring Boot milestone repositories.
97+
recipe: sbu30-add-milestone-repositories
98+
gitHubIssue: 441
99+
contributors:
100+
- "Fabian Krüger[@fabapp2]"
88101

89102
- title: Changes to Data Properties
90103
helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.ChangesToDataPropertiesHelper
@@ -123,8 +136,8 @@
123136
remediation:
124137
description: |-
125138
Set `logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS` to fall back to the previous log format.
139+
recipe: sbu30-225-logging-date-format
126140
gitHubIssue: 489
127-
recipe: sbu30-225-logging-date-format
128141
contributors:
129142
- "Fabian Krüger[@fabapp2]"
130143

@@ -175,6 +188,7 @@
175188
for more information
176189
resources:
177190
- https://github.com/spring-projects-experimental/spring-boot-migrator/issues/166[Issue 166]
191+
recipe: sbu30-remove-construtor-binding
178192
gitHubIssue: 166
179193
recipe: boot-2.7-3.0-upgrade-report
180194
contributors:
@@ -320,6 +334,7 @@
320334
remediation:
321335
description: |-
322336
If one requires the old behavior one must extend not only the sorting repository, but also the respective CRUD repository explicitly. This was done so the sorting support could easily be combined with the List repositories introduced above.
337+
recipe: sbu30-paging-and-sorting-repository
323338
gitHubIssue: 518
324339
contributors:
325340
- "Sandeep Nagaraj[@sanagaraj-pivotal]"

0 commit comments

Comments
 (0)