Skip to content

Commit 5b344c9

Browse files
committed
feat: Add report section "Updated Phases for Graceful Shutdown"
1 parent e1555a5 commit 5b344c9

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,39 @@
668668
# - Your Name[@your-gh-handle]
669669

670670

671+
#
672+
# Generated from https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#updated-phases-for-graceful-shutdown
673+
#
674+
- title: "Updated Phases for Graceful Shutdown"
675+
helper:
676+
type: org.springframework.sbm.boot.upgrade_27_30.report.helper.ConditionOnlyHelper
677+
condition:
678+
type: org.springframework.sbm.build.migration.conditions.AnyEffectiveDependencyExistMatchingRegex
679+
dependencies:
680+
- 'org\.springframework\.boot\:spring-boot\:.*'
681+
682+
change: |-
683+
The phases used by the `SmartLifecycle` implementations for graceful shutdown have been updated.
684+
Graceful shutdown now begins in phase `SmartLifecycle.DEFAULT_PHASE - 2048` and the web server is stopped in phase `SmartLifecycle.DEFAULT_PHASE - 1024`.
685+
Any `SmartLifecycle` implementations that were participating in graceful shutdown should be updated accordingly.
686+
687+
affected: |-
688+
Actually, we don't know if the scanned application is really affected by this change.
689+
But we found a dependency matching regex `org\.springframework\.boot\:spring-boot\:.*`.
690+
This indicates that the scanned application might be affected.
691+
remediation:
692+
description: |-
693+
[IMPORTANT]
694+
====
695+
This section has been automatically generated from the https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#updated-phases-for-graceful-shutdown[Spring Boot 3.0 Migration Guide^, role="ext-link"]. +
696+
**Please consider contributing to issue https://github.com/spring-projects-experimental/spring-boot-migrator/issues/630[#630^, role="ext-link"]**
697+
====
698+
projects:
699+
- spring-web
700+
gitHubIssue: 630
701+
# contributors:
702+
# - Your Name[@your-gh-handle]
703+
671704
footer: |-
672705
We want to say thank you to all Contributors:
673706
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright 2021 - 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.sbm.boot.upgrade_27_30.report.helper;
17+
18+
import org.junit.jupiter.api.Test;
19+
import org.junit.jupiter.api.DisplayName;
20+
import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportTestSupport;
21+
import org.springframework.sbm.engine.context.ProjectContext;
22+
import org.springframework.sbm.project.resource.TestProjectContext;
23+
24+
class UpdatedPhasesForGracefulShutdownReportSectionTest {
25+
@Test
26+
@DisplayName("Updated Phases for Graceful Shutdown should render")
27+
void withSingleModuleApplicationShouldRender() {
28+
ProjectContext context = TestProjectContext
29+
.buildProjectContext()
30+
.withSpringBootParentOf("2.7.5")
31+
.withBuildFileHavingDependencies("org.springframework.boot:spring-boot:2.7.5")
32+
.build();
33+
34+
SpringBootUpgradeReportTestSupport.generatedSection("Updated Phases for Graceful Shutdown")
35+
.fromProjectContext(context)
36+
.shouldRenderAs("""
37+
=== Updated Phases for Graceful Shutdown
38+
39+
==== What Changed
40+
The phases used by the `SmartLifecycle` implementations for graceful shutdown have been updated.
41+
Graceful shutdown now begins in phase `SmartLifecycle.DEFAULT_PHASE - 2048` and the web server is stopped in phase `SmartLifecycle.DEFAULT_PHASE - 1024`.
42+
Any `SmartLifecycle` implementations that were participating in graceful shutdown should be updated accordingly.
43+
44+
==== Why is the application affected
45+
Actually, we don't know if the scanned application is really affected by this change.
46+
But we found a dependency matching regex `org\\.springframework\\.boot\\:spring-boot\\:.*`.
47+
This indicates that the scanned application might be affected.
48+
49+
==== Remediation
50+
[IMPORTANT]
51+
====
52+
This section has been automatically generated from the https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#updated-phases-for-graceful-shutdown[Spring Boot 3.0 Migration Guide^, role="ext-link"]. +
53+
**Please consider contributing to issue https://github.com/spring-projects-experimental/spring-boot-migrator/issues/630[#630^, role="ext-link"]**
54+
====
55+
56+
57+
""");
58+
}
59+
60+
@Test
61+
@DisplayName("Updated Phases for Graceful Shutdown should not render")
62+
void shouldNotRender() {
63+
ProjectContext context = TestProjectContext
64+
.buildProjectContext()
65+
.build();
66+
67+
SpringBootUpgradeReportTestSupport.generatedSection("Updated Phases for Graceful Shutdown")
68+
.fromProjectContext(context)
69+
.shouldNotRender();
70+
}
71+
}

0 commit comments

Comments
 (0)