Skip to content

Commit 772dc2d

Browse files
SBM now reports the deprecation of CommonsMultipartResolver bean (#549)
* SBM now reports the deprecation of CommonsMultipartResolver bean * Add a line break on report when listing different types
1 parent fb52fb1 commit 772dc2d

File tree

6 files changed

+236
-189
lines changed

6 files changed

+236
-189
lines changed

components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/checks/CommonsMultipartResolverBeanFinder.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/checks/CommonsMultipartResolverSectionBuilder.java

Lines changed: 0 additions & 79 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
17+
package org.springframework.sbm.boot.upgrade_27_30.report.helper;
18+
19+
import org.springframework.sbm.boot.common.finder.MatchingMethod;
20+
import org.springframework.sbm.boot.common.finder.SpringBeanMethodDeclarationFinder;
21+
import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportSection;
22+
import org.springframework.sbm.engine.context.ProjectContext;
23+
24+
import java.util.HashMap;
25+
import java.util.List;
26+
import java.util.Map;
27+
import java.util.stream.Collectors;
28+
29+
public class CommonsMultipartResolverHelper implements SpringBootUpgradeReportSection.Helper<List<String>>{
30+
private static final String COMMONS_MULTIPART_RESOLVER_CLASS = "org.springframework.web.multipart.commons.CommonsMultipartResolver";
31+
private List<String> types;
32+
33+
@Override
34+
public String getDescription() {
35+
return null;
36+
}
37+
38+
@Override
39+
public boolean evaluate(ProjectContext context) {
40+
List<MatchingMethod> search = context
41+
.search(
42+
new SpringBeanMethodDeclarationFinder(
43+
COMMONS_MULTIPART_RESOLVER_CLASS
44+
)
45+
);
46+
47+
types = search.stream()
48+
.map(k -> k.getType().getFullyQualifiedName())
49+
.collect(Collectors.toList());
50+
51+
return !search.isEmpty();
52+
}
53+
54+
@Override
55+
public Map<String, List<String>> getData() {
56+
return Map.of("types", types);
57+
}
58+
}

components/sbm-recipes-boot-upgrade/src/main/resources/recipes/boot-new-report.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,22 @@
323323
contributors:
324324
- "Sandeep Nagaraj[@sanagaraj-pivotal]"
325325

326+
- title: Commons Multipart Upload
327+
helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.CommonsMultipartResolverHelper
328+
change: |-
329+
Support for Spring Framework’s `CommonsMultipartResolver` has been removed following its removal in Spring Framework 6
330+
affected: |-
331+
We found usage of `CommonsMultipartResolver` in following files:
332+
333+
<#list types as type>
334+
* `${type}`
335+
</#list>
336+
remediation:
337+
description: |-
338+
Remove beans of type `CommonsMultipartResolver` and rely on Spring Boot auto-configuration
339+
gitHubIssue: 541
340+
contributors:
341+
- "Sandeep Nagaraj[@sanagaraj-pivotal]"
326342
footer: |-
327343
We want to say thank you to all Contributors:
328344

components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/checks/CommonsMultipartResolverSectionBuilderTest.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)