diff --git a/.github/ISSUE_TEMPLATE/3-0-upgrade-recipe.md b/.github/ISSUE_TEMPLATE/3-0-upgrade-recipe.md
new file mode 100644
index 000000000..0924fe381
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/3-0-upgrade-recipe.md
@@ -0,0 +1,55 @@
+---
+name: 3.0 Upgrade Recipe
+about: Template for Spring Boot 3 Upgrade Receipe
+title: '3.0 Upgrade Recipe: '
+labels: '3.0.0, good first issue, type: enhancement, upgrade:boot-recipe'
+assignees: ''
+
+---
+
+## What needs to be done
+
+An automated migration recipe for [`{{Release Note title}}`]({{http://link-to-section.foo}}) should be created.
+
+
+### Condition
+{{Describe when the section should be rendered}}
+
+
+### Report Section Issue
+
+{{GH id for report issue}}
+
+
+### DoD
+- [ ] Action implemented
+ - [ ] Description provided
+ - [ ] Tests (single and multi-module)
+- [ ] Condition implemented / reused
+ - [ ] Description provided
+ - [ ] Tests (single and multi-module)
+- [ ] Recipe yaml added
+ - [ ] Test
+ - [ ] Integration test (single and multi-module)
+
+
+
+## Recipe YAML Example
+
+This provides an example with information about how a automated migration recipe should be defined in `YAML`.
+
+
+Report Section YAML (example)
+
+````yaml
+
+````
+
+
+
+## Additional Resources & Information
+- Example
+- Testing Actions
+- Testing Conditions
+- Testing Recipes
+- Integration Tests
diff --git a/.github/ISSUE_TEMPLATE/3-0-upgrade-report-section.md b/.github/ISSUE_TEMPLATE/3-0-upgrade-report-section.md
new file mode 100644
index 000000000..8a45b3429
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/3-0-upgrade-report-section.md
@@ -0,0 +1,103 @@
+---
+name: 3.0 Upgrade Report Section
+about: Template for Spring Boot 3 Upgrade Report Section
+title: '3.0 Upgrade Report: '
+labels: '3.0.0, good first issue, type: enhancement, upgrade:boot-report'
+assignees: ''
+
+---
+
+## What needs to be done
+
+A report section for [`{{Release Note title}}`]({{http://link-to-section.foo}}) should be added to the Spring Boot 3 Upgrade Report.
+
+The section in the report for this change must be provided in `YAML` which will be used to render the asciidoctor markup which will finally be used to render the report.
+
+A class implementing the interface `SpringBootUpgradeReportSection.Helper` must be provided.
+````java
+ public interface Helper extends Condition {
+ /**
+ * @return {@code Map} the model data for the template.
+ */
+ Map getData(ProjectContext context);
+ }
+````
+
+The fully qualified name of this class must be referenced in the `YAML` describing the report section (see below).
+It will be used as `Condition` to define if the section should rendered and
+as `DataProvider` providing data to the freemarker template markup.
+
+
+### Condition
+{{Describe when the section should be rendered}}
+
+
+### DoD
+- [ ] Created `Helper` and referenced the fully qualified name in the yaml [[example](https://github.com/spring-projects-experimental/spring-boot-migrator/blob/8cc692233e949fc152126633ad0f69d9cd6c08e4/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/ConstructorBindingHelper.java#L36)]
+- [ ] Created test for the `Helper` against single and multi-module code (where applicable) [[example](https://github.com/spring-projects-experimental/spring-boot-migrator/blob/59ab7720d0961ec22cda9ed0bc48c78dd91fd1cf/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/ConstructorBindingHelperTest.java#L25)]
+- [ ] Created a test for the rendered section in asciidoctor markup
+- [ ] Create a negative test using `shouldNotRender`
+
+
+## YAML Example
+
+This provides an example with information about how a report section can be defined in `YAML`.
+[Freemarker syntax](https://freemarker.apache.org/docs/ref.html) can be used to render the asciidoctor code.
+
+
+Report Section YAML (example)
+
+````yaml
+- title: Add the title from Release Notes section
+ helper: fully qualified name of the Helper class
+ change: |-
+ Add the description from the Relase Notes section
+ This can be multiline, ident (two spaces) is important
+ sources:
+ - http://some-link-to-the-relase-note.html
+ - http://some-link-to-some-other-relase-note.html
+ affected: |-
+ Why is the scanned application affected?
+ Describes the matches of the `Finder` that made the condition for this section apply
+ <#list matches as match>
+ * file://${match.absolutePath}[`${match.relativePath}`]<#lt>
+ <#list match.propertiesFound as property>
+ ** `${property}`<#lt>
+ #list>
+ #list>
+ remediation:
+ description: |-
+ Describe what the user needs to do to remediate this change in the scanned application.
+ This should be as descriptive as possible and can potentially serve as the requirement
+ for a later migration recipe that migrates the steps.
+ It is possible that different ways exist, in this case use this format
+ possibilities:
+ - title: The title of this remediation
+ description: |-
+ Detailed description of this approach and what the implications are
+ Use checkboxes if there's a sequence of steps
+ - [ ] Step 1
+ - [ ] Step 2
+ recipe: Name of the migration recipe for this remediation, if any
+ resources:
+ - Optional List of further resources like
+ - blog.spring.io/some-blog-article
+ - title: Title of the next remediation
+ description:
+ Detailed description of this approach and what the implications are
+ ````java
+ codeblocks can be used here, even containing codeblocks with freemarker template code
+ like ${className}
+ ````
+ gitHubIssue: add the id of this issue, like 123
+ projects:
+ - spring-boot
+ - [Some other project]http://link-to-some-other.project
+ contributors:
+ - Fabian Krüger[@fabapp2]
+ - Displayed Name[@GitHubName]
+````
+
+
+
+## Additional Resources & Information
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 9ccb13254..13870e80a 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
-labels: ''
+labels: 'type: bug'
assignees: ''
---
@@ -10,6 +10,12 @@ assignees: ''
**Describe the bug**
A clear and concise description of what the bug is.
+**SBM Version**
+Provide the version or commit hash that was used.
+
+**SBM Application**
+Provide the application that was used. (shell, boot-upgrade, ...)
+
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
diff --git a/.github/workflows/build-asciidoc.yml b/.github/workflows/build-asciidoc.yml
index c0ab8a94a..1d61f5447 100644
--- a/.github/workflows/build-asciidoc.yml
+++ b/.github/workflows/build-asciidoc.yml
@@ -10,10 +10,10 @@ jobs:
name: Asciidoctoring the docs to pretty HTML!
steps:
- name: Checkout code
- uses: actions/checkout@v3
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3
- name: Get build container
id: adocbuild
- uses: avattathil/asciidoctor-action@master
+ uses: tonynv/asciidoctor-action@28d076475809567f00d35696db08f8454d70eabb # pin@28d076475809567f00d35696db08f8454d70eabb
with:
program: "asciidoctor --backend=html5 -D docs -r asciidoctor-diagram docs/reference/*.adoc"
# asciidoctor --backend=html5 -D output docs/reference/developer-documentation.adoc
@@ -21,9 +21,8 @@ jobs:
# -a stylesheet=style.css
# && echo 'docs..io' > docs/CNAME"
- name: Deploy docs to ghpages
- uses: peaceiris/actions-gh-pages@v3
+ uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 # pin@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_branch: gh-pages
publish_dir: ./docs
-
diff --git a/.github/workflows/check-license-headers.yml b/.github/workflows/check-license-headers.yml
index a397824bc..1a45c9a6a 100644
--- a/.github/workflows/check-license-headers.yml
+++ b/.github/workflows/check-license-headers.yml
@@ -9,6 +9,6 @@ jobs:
check-license-lines:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3
- name: Check License Lines
- uses: kt3k/license_checker@v1.0.6
\ No newline at end of file
+ uses: kt3k/license_checker@d12a6d90c58e30fefed09f2c4d03ba57f4c673a8 # pin@v1.0.6
diff --git a/.github/workflows/mvn-build.yml b/.github/workflows/mvn-build.yml
deleted file mode 100644
index 10f95d3ca..000000000
--- a/.github/workflows/mvn-build.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: Java CI
-on:
- push:
- branches: '**'
- pull_request:
- branches:
- - main
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
- - name: Set up JDK 17
- uses: actions/setup-java@v3
- with:
- java-version: '17'
- distribution: 'adopt'
- cache: 'maven'
- - name: Build with Maven
- run: mvn --update-snapshots -DtrimStackTrace=false -Dsurefire.useFile=false -DskipITs verify
diff --git a/README.adoc b/README.adoc
index b0b8fde4e..5bfa20cd0 100644
--- a/README.adoc
+++ b/README.adoc
@@ -1,6 +1,14 @@
= Spring Boot Migrator (SBM)
-image:https://badges.gitter.im/spring-boot-migrator/community.svg[link="https://gitter.im/spring-boot-migrator/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
+
+image:https://img.shields.io/github/license/spring-projects-experimental/spring-boot-migrator[GitHub]
+image:https://img.shields.io/github/v/release/spring-projects-experimental/spring-boot-migrator[GitHub release (latest by date)]
+image:https://img.shields.io/github/downloads/spring-projects-experimental/spring-boot-migrator/0.13.0/total[GitHub release (latest by date)]
+image:https://img.shields.io/youtube/channel/views/UC6NuSiwpvI32YTcdIflObPQ?logo=youtube&style=flat-square[YouTube Channel Views]
+
+image:https://img.shields.io/badge/Join-Slack-green?logo=slack&color=007EC6&style=for-the-badge[link="https://join.slack.com/t/springbootmigrator/shared_invite/zt-1k6yxfi3b-MEQ_MM67qXufWtc~Tw6y9w"]
+image:https://img.shields.io/github/discussions/spring-projects-experimental/spring-boot-migrator?label=GitHub%20discussions&logo=GitHUb&style=for-the-badge[GitHub Discussions]
+image:https://img.shields.io/gitter/room/spring-boot-migrator/community?color=007EC6&logo=gitter&style=for-the-badge[link="https://gitter.im/spring-boot-migrator/community"]
[quote]
____
@@ -15,33 +23,59 @@ ____
❌ Gradle
-== Spring Boot 3.0 Upgrades
+== Spring Boot 3.0 Upgrades
We are working on automated upgrade from Spring Boot 2.7 to Spring Boot 3.0.
+Click the image to watch a demo video [2:26]
+
+ifdef::env-github[]
+image:https://img.youtube.com/vi/RKXblzn8lFg/maxresdefault.jpg[link=https://www.youtube.com/embed/RKXblzn8lFg]
+endif::[]
+
+=== Try the Spring Boot Upgrade Tool
+NOTE: **Use JDK 17**
+
+. Download the https://github.com/spring-projects-experimental/spring-boot-migrator/releases/download/latest/spring-boot-upgrade.jar[spring-boot-upgrade.jar]
+. Run `java -jar --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED spring-boot-upgrade.jar `
+
If any of your applications is on 2.7 and uses Maven (Gradle is currently not supported), we'd be happy if you
could give SBM a try and provide feedback of how it worked out.
It is very hard to come up with all the possible setups found in the wild and therefor we need you - the community - to provide feedback to stabilize the recipe.
Thank you!
-Download the https://github.com/spring-projects-experimental/spring-boot-migrator/releases[latest release]
-
-- Start SBM: `java -jar spring-boot-migrator.jar`
-- Scan your application: `scan `
-- generate a report first: `apply boot-2.7-3.0-upgrade-report`
-- Run the migration: `apply boot-2.7-3.0-dependency-version-update`
-
=== Contributing
-
Any contribution is appreciated!
-If you want to get involved, please have a look at https://github.com/spring-projects-experimental/spring-boot-migrator/discussions/446[this discussion] where we provide additional information related to the Spring Boot 3 Upgrade.
+If you want to get involved, please have a look at https://github.com/spring-projects-experimental/spring-boot-migrator/wiki/Spring-Boot-3-Upgrade-Report-Contribution-Guideline[Spring Boot 3 Upgrade Report Contribution Guideline] where we provide information related to contributing to the Spring Boot 3 Upgrade.
Please don't hesitate to ask questions and provide feedback.
+Find the list of Spring Boot 3 Upgrade related issues labeled as `good first issue` https://github.com/spring-projects-experimental/spring-boot-migrator/issues?q=is%3Aissue+is%3Aopen+label%3A3.0.0+label%3A%22good+first+issue%22+[here]
+
If you decided you want to work on an issue, leave a comment letting us know that you want to work on it and we go from there.
Thank you!
+== JEE to Spring Boot Migration
+Spring Boot Migrator offers recipes to migrate JEE applications to Spring Boot.
+
+These specifications are covered (to some extent and varying completeness)
+
+* Servlet
+* JAX-RS
+* SOAP
+* JMS
+* EJB
+* JPA
+* ejb-jar.xml
+* weblogic-ejb-jar.xml
+
+Click the image to watch a demo video [16:57]
+
+ifdef::env-github[]
+image:https://img.youtube.com/vi/PnvsLafekWE/maxresdefault.jpg[link=https://www.youtube.com/embed/PnvsLafekWE]
+endif::[]
+
== How SBM works
Spring Boot Migrator uses and is compatible with https://github.com/openrewrite/rewrite[OpenRewrite,window=_blank],
@@ -66,7 +100,7 @@ image::images/apply.png[]
== Getting started
-* Download the latest release from here: https://github.com/spring-projects-experimental/spring-boot-migrator/releases[Spring Boot Migrator Releases]
+* Download the latest release from here: https://github.com/spring-projects-experimental/spring-boot-migrator/releases/latest[Spring Boot Migrator Releases]
* Start the application: `java -jar spring-boot-migrator.jar`
* In the CLI start by scanning the application `scan `
* From the list of applicable recipes select the one you want to apply, +
diff --git a/applications/rest-service/src/test/java/org/springframework/sbm/service/RestApiTest.java b/applications/rest-service/src/test/java/org/springframework/sbm/service/RestApiTest.java
deleted file mode 100644
index 4de16d9da..000000000
--- a/applications/rest-service/src/test/java/org/springframework/sbm/service/RestApiTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2021 - 2022 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.sbm.service;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Map;
-
-import org.junit.jupiter.api.*;
-import org.springframework.sbm.service.dto.RecipeInfo;
-import org.apache.commons.io.FileUtils;
-import org.junit.jupiter.api.io.TempDir;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.http.ResponseEntity;
-
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class RestApiTest {
-
- @LocalServerPort
- private int port;
-
- @Autowired
- private TestRestTemplate restTemplate;
-
- @TempDir
- File tempFolder;
-
- @BeforeEach
- void setup() throws IOException {
- FileUtils.cleanDirectory(tempFolder);
- }
-
- @Test
- public void scanNoParameters() throws Exception {
- ResponseEntity> recipes = this.restTemplate.postForEntity("http://localhost:" + port + "/scan", null, Object.class);
- assertThat(recipes.getStatusCode().isError()).isTrue();
- }
-
- @Test
- public void scanProject() throws Exception {
- File testProject = ProjectUtils.initTestProject(tempFolder, "bootify-jaxrs");
- Map params = Map.of("projectPath", testProject.toString());
- ResponseEntity recipes = this.restTemplate.postForEntity("http://localhost:" + port + "/scan?projectPath={projectPath}", null, RecipeInfo[].class, params);
- assertThat(recipes.getStatusCode().isError()).isFalse();
- assertThat(recipes.getBody().length).isGreaterThan(0);
- }
-
- @Test
- @Disabled("Fails somtimes in CI 'RestApiTest.applyRecipe:76 ? ResourceAccess I/O error on POST request for \"htt...' and will be replaced by Websocket API")
- public void applyRecipe() throws Exception {
- File testProject = ProjectUtils.initTestProject(tempFolder, "bootify-jaxrs");
- Path bootAppMainClass = testProject.toPath().resolve("src/main/java/com/example/jee/app/SpringBootApp.java");
- assertThat(Files.exists(bootAppMainClass)).isFalse();
- Map params = Map.of("projectPath", testProject.toString(), "recipe", "initialize-spring-boot-migration");
- ResponseEntity recipes = this.restTemplate.postForEntity("http://localhost:" + port + "/apply?projectPath={projectPath}&recipe={recipe}", null, Void.class, params);
- assertThat(recipes.getStatusCode().isError()).isFalse();
- assertThat(Files.exists(bootAppMainClass)).isTrue();
- }
-
-}
diff --git a/applications/rest-service/pom.xml b/applications/spring-boot-upgrade/pom.xml
similarity index 62%
rename from applications/rest-service/pom.xml
rename to applications/spring-boot-upgrade/pom.xml
index 0e56cb3c1..37d90383b 100644
--- a/applications/rest-service/pom.xml
+++ b/applications/spring-boot-upgrade/pom.xml
@@ -20,29 +20,19 @@
org.springframework.sbmspring-boot-migrator
- 0.12.1-SNAPSHOT
+ 0.13.1-SNAPSHOT../../pom.xml
- rest-service
+ spring-boot-upgradejarorg.springframework.sbm
- sbm-recipes-spring-framework
- ${project.version}
-
-
- org.springframework.sbm
- sbm-recipes-jee-to-boot
- 0.12.1-SNAPSHOT
-
-
- org.springframework.sbm
- sbm-core
- ${project.version}
+ sbm-recipes-boot-upgrade
+ 0.13.1-SNAPSHOTorg.springframework.boot
@@ -53,30 +43,10 @@
spring-boot-starter-testtest
-
- org.springframework.sbm
- test-helper
- test
-
-
-
- org.springframework.sbm
- sbm-support-weblogic
- 0.12.1-SNAPSHOT
-
-
- org.springframework.sbm
- openrewrite-spring-recipes
- ${project.version}
- org.springframework.bootspring-boot-starter-web
-
- org.springframework.boot
- spring-boot-starter-actuator
-
@@ -90,8 +60,23 @@
repackage
+
+
+
+ org.asciidoctor
+ asciidoctorj
+
+
+ io.spring.asciidoctor.backends
+ spring-asciidoctor-backends
+
+
+
+
+ spring-boot-upgrade
+
diff --git a/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/ReportController.java b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/ReportController.java
new file mode 100644
index 000000000..6f9f70c0c
--- /dev/null
+++ b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/ReportController.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2021 - 2022 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.sbm;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.Value;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportRenderer;
+import org.springframework.sbm.engine.commands.ApplyCommand;
+import org.springframework.sbm.engine.context.ProjectContext;
+import org.springframework.sbm.engine.context.ProjectContextHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Controller
+@CrossOrigin
+class ReportController{
+
+ @Autowired
+ private ApplyCommand applyCommand;
+ @Autowired
+ private ReportHolder reportHolder;
+
+ @Autowired
+ private ProjectContextHolder contextHolder;
+
+ public static final String REPORT_RECIPE = "sbu30-report";
+
+ private boolean isInitialReport = true;
+
+ @GetMapping(path = "/spring-boot-upgrade", produces = MediaType.TEXT_HTML_VALUE)
+ @ResponseBody
+ public String upgrade() {
+ // Urgh... that's nasty
+ if(!isInitialReport) {
+ applyCommand.execute(contextHolder.getProjectContext(), REPORT_RECIPE);
+ }
+ isInitialReport = false;
+ return reportHolder.getReport();
+ }
+
+ @PostMapping(path = "/spring-boot-upgrade", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.TEXT_HTML_VALUE)
+ @ResponseBody
+ public String applyRecipes(@RequestParam("recipeNames[]") String[] recipeNames) {
+ ProjectContext context = contextHolder.getProjectContext();
+ List.of(recipeNames).forEach(recipeName -> applyCommand.execute(context, recipeName));
+ applyCommand.execute(context, REPORT_RECIPE);
+ return reportHolder.getReport();
+ }
+
+ @PostMapping(path = "/spring-boot-upgrade")
+ @ResponseBody
+ public void applyRecipes2(@RequestBody Recipe recipeNames) {
+ ProjectContext context = contextHolder.getProjectContext();
+ recipeNames.getRecipes().forEach(
+ recipeName -> applyCommand.execute(context, recipeName)
+ );
+ applyCommand.execute(context, REPORT_RECIPE);
+ }
+
+ @Getter
+ @Setter
+ static class Recipe {
+ private List recipes;
+ }
+}
diff --git a/applications/rest-service/src/main/java/org/springframework/sbm/SpringBootMigratorServiceApp.java b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/ReportHolder.java
similarity index 67%
rename from applications/rest-service/src/main/java/org/springframework/sbm/SpringBootMigratorServiceApp.java
rename to applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/ReportHolder.java
index 789128991..feb517047 100644
--- a/applications/rest-service/src/main/java/org/springframework/sbm/SpringBootMigratorServiceApp.java
+++ b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/ReportHolder.java
@@ -15,14 +15,16 @@
*/
package org.springframework.sbm;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class SpringBootMigratorServiceApp {
-
- public static void main(String[] args) {
- SpringApplication.run(SpringBootMigratorServiceApp.class, args);
- }
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.stereotype.Component;
+/**
+ * @author Fabian Krüger
+ */
+@Component
+@Getter
+@Setter
+public class ReportHolder {
+ private String report = "";
}
diff --git a/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootMigratorRunner.java b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootMigratorRunner.java
new file mode 100644
index 000000000..00eded060
--- /dev/null
+++ b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootMigratorRunner.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2021 - 2022 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.sbm;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.sbm.engine.commands.ApplyCommand;
+import org.springframework.sbm.engine.commands.ScanCommand;
+import org.springframework.sbm.engine.context.ProjectContext;
+import org.springframework.sbm.engine.context.ProjectContextHolder;
+
+@Configuration
+@RequiredArgsConstructor
+public class SpringBootMigratorRunner implements ApplicationRunner {
+
+ private final ScanCommand scanCommand;
+ private final ProjectContextHolder contextHolder;
+ private final ApplyCommand applyCommand;
+ private final String REPORT_RECIPE = "sbu30-report";
+
+ @Override
+ public void run(ApplicationArguments args) {
+ if (args.getSourceArgs().length == 0) {
+ System.err.println("PLease provide the path to the application as parameter.");
+ return;
+ }
+ String applicationPath = args.getSourceArgs()[0];
+ System.out.println("Scanning " + applicationPath);
+ ProjectContext context = scanCommand.execute(applicationPath);
+ contextHolder.setProjectContext(context);
+ applyCommand.execute(contextHolder.getProjectContext(), REPORT_RECIPE);
+ System.out.println("finished scan. Please open: http://localhost:8080/spring-boot-upgrade");
+ }
+
+
+}
diff --git a/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootUpgradeReportApp.java b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootUpgradeReportApp.java
new file mode 100644
index 000000000..5a38f5f8a
--- /dev/null
+++ b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootUpgradeReportApp.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2021 - 2022 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.sbm;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @author Fabian Krüger
+ */
+@SpringBootApplication
+public class SpringBootUpgradeReportApp {
+ public static void main(String[] args) {
+ try {
+ SpringApplication.run(SpringBootUpgradeReportApp.class, args);
+ } catch (Exception exception) {
+ System.err.println(exception.getMessage());
+ exception.printStackTrace();
+ }
+ }
+
+ @Bean
+ public WebMvcConfigurer corsConfigurer() {
+ return new WebMvcConfigurer() {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**").allowedMethods("*");
+ }
+ };
+ }
+}
diff --git a/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootUpgradeReportStringRenderer.java b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootUpgradeReportStringRenderer.java
new file mode 100644
index 000000000..66ca2af0e
--- /dev/null
+++ b/applications/spring-boot-upgrade/src/main/java/org/springframework/sbm/SpringBootUpgradeReportStringRenderer.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2021 - 2022 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.sbm;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
+import org.springframework.sbm.boot.upgrade.common.UpgradeReportUtil;
+import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportRenderer;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Fabian Krüger
+ */
+@Component
+@Primary
+public class SpringBootUpgradeReportStringRenderer implements SpringBootUpgradeReportRenderer {
+ @Autowired
+ private ReportHolder reportHolder;
+ @Override
+ public void processReport(String renderedReport) {
+ String htmlReport = UpgradeReportUtil.renderHtml(renderedReport);
+ String closingHeadTag = "";
+
+ String additionalHeader =
+// "\n" +
+// "\n" +
+// "\n" +
+
+// "\n";
+// htmlReport = htmlReport.replace(closingHeadTag, additionalHeader + closingHeadTag);
+
+ htmlReport = htmlReport.replace("