Skip to content

Commit 0eae236

Browse files
Merge pull request #32818 from anjumfatima90/SB4ManagementContext
Support Spring Boot 4 management context
2 parents d892b1e + bbacc6b commit 0eae236

File tree

14 files changed

+106
-17
lines changed

14 files changed

+106
-17
lines changed

dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4661,6 +4661,11 @@
46614661
<artifactId>package-url-java</artifactId>
46624662
<version>1.0.1</version>
46634663
</dependency>
4664+
<dependency>
4665+
<groupId>org.springframework.boot</groupId>
4666+
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
4667+
<version>4.0.0-M1</version>
4668+
</dependency>
46644669
<dependency>
46654670
<groupId>org.springframework.boot</groupId>
46664671
<artifactId>spring-boot-autoconfigure</artifactId>

dev/cnf/oss_dependencies.maven

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ org.slf4j:slf4j-api:1.7.36
928928
org.slf4j:slf4j-jdk14:1.7.36
929929
org.slf4j:slf4j-simple:1.7.36
930930
org.sonatype.goodies:package-url-java:1.0.1
931+
org.springframework.boot:spring-boot-actuator-autoconfigure:4.0.0-M1
931932
org.springframework.boot:spring-boot-autoconfigure:1.5.9.RELEASE
932933
org.springframework.boot:spring-boot-autoconfigure:2.7.18
933934
org.springframework.boot:spring-boot-autoconfigure:3.3.5

dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/util/SpringBootThinUtil.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,10 +700,18 @@ public String toString() {
700700
}
701701

702702
public static String getArtifactId(String jarName) {
703-
// jarName :: [<dirPath>/]<artifactId>-<version>.jar
703+
// jarName :: [<dirPath>/]<artifactId>-<version>-M1.jar
704+
//-M1 in the version of artifact ids is for milestone versions. Getting the right artifact id is essential to filter them out correctly.
704705
int idxBegAid = jarName.lastIndexOf('/') + 1;
705-
int idxEndAid = jarName.lastIndexOf('-') - 1;
706-
return ((idxBegAid <= idxEndAid) && jarName.endsWith(".jar")) ? jarName.substring(idxBegAid, idxEndAid + 1).toLowerCase() : "";
706+
int idxEndAid = -1;
707+
708+
for (int i = 0; i < jarName.length() - 1; i++) {
709+
if (jarName.charAt(i) == '-' && Character.isDigit(jarName.charAt(i + 1))) {
710+
idxEndAid = i;
711+
break;
712+
}
713+
}
714+
return ((idxBegAid <= idxEndAid) && jarName.endsWith(".jar")) ? jarName.substring(idxBegAid, idxEndAid).toLowerCase() : "";
707715
}
708716

709717
/**

dev/com.ibm.ws.app.manager.springboot/test/com/ibm/ws/app/manager/springboot/util/EmbeddedContainerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018, 2022 IBM Corporation and others.
2+
* Copyright (c) 2018, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
66
* http://www.eclipse.org/legal/epl-2.0/
7-
*
7+
*
88
* SPDX-License-Identifier: EPL-2.0
99
*
1010
* Contributors:
@@ -85,7 +85,7 @@ public void testGetArtifactId() throws Exception {
8585
expected = "a"; // no dirPath, smallest artifact
8686
assertTrue("Artifact name is " + expected, expected.equals(getArtifactId("a-2.jar")));
8787
expected = "b"; // dirPath, smallest artifact
88-
assertTrue("Artifact name is " + expected, expected.equals(getArtifactId("/b-c.jar")));
88+
assertTrue("Artifact name is " + expected, expected.equals(getArtifactId("/b-2.jar")));
8989
}
9090

9191
@Test

dev/io.openliberty.springboot.fat40.app/bnd.bnd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ src: \
3838
-testpath: \
3939
org.springframework.boot:spring-boot;${springBootVersion40}, \
4040
org.springframework.boot:spring-boot-autoconfigure;${springBootVersion40}, \
41+
org.springframework.boot:spring-boot-web-server;${springBootVersion40},
4142
\
4243
org.springframework:spring-beans;${springVersion40}, \
4344
org.springframework:spring-context;${springVersion40}, \
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2018,2023 IBM Corporation and others.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License 2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* IBM Corporation - initial API and implementation
12+
*******************************************************************************/
13+
package com.ibm.ws.springboot.fat40.test.app;
14+
15+
16+
import org.springframework.boot.web.server.MimeMappings;
17+
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
18+
import org.springframework.boot.web.server.servlet.ConfigurableServletWebServerFactory;
19+
import org.springframework.stereotype.Component;
20+
21+
@Component
22+
public class CustomizationBean implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
23+
24+
@Override
25+
public void customize(ConfigurableServletWebServerFactory server) {
26+
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
27+
mappings.add("weby","application/json");
28+
server.setMimeMappings(mappings);
29+
}
30+
31+
}

dev/io.openliberty.springboot.fat40.multicontext.app/src/main/java/com/ibm/ws/springboot/fat40/multicontext/app/part0/Config.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018,2023 IBM Corporation and others.
2+
* Copyright (c) 2018,2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -16,7 +16,7 @@
1616
import org.springframework.context.annotation.Configuration;
1717

1818
@Configuration
19-
@ComponentScan("com.ibm.ws.springboot.fat30.multicontext.app.part0")
19+
@ComponentScan("com.ibm.ws.springboot.fat40.multicontext.app.part0")
2020
public class Config {
2121
// EMPTY
2222
}

dev/io.openliberty.springboot.fat40.multicontext.app/src/main/java/com/ibm/ws/springboot/fat40/multicontext/app/part00/ServletConfig1.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018,2023 IBM Corporation and others.
2+
* Copyright (c) 2018,2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@
1919

2020

2121
@Configuration
22-
@ComponentScan("com.ibm.ws.springboot.fat30.multicontext.app.part00")
22+
@ComponentScan("com.ibm.ws.springboot.fat40.multicontext.app.part00")
2323
@PropertySource("classpath:servlet1.properties")
2424
@EnableAutoConfiguration
2525
public class ServletConfig1 {

dev/io.openliberty.springboot.fat40.multicontext.app/src/main/java/com/ibm/ws/springboot/fat40/multicontext/app/part01/ServletConfig2.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018,2023 IBM Corporation and others.
2+
* Copyright (c) 2018,2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
1818
import org.springframework.context.annotation.PropertySource;
1919

2020
@Configuration
21-
@ComponentScan("com.ibm.ws.springboot.fat30.multicontext.app.part01")
21+
@ComponentScan("com.ibm.ws.springboot.fat40.multicontext.app.part01")
2222
@PropertySource("classpath:servlet2.properties")
2323
@EnableAutoConfiguration
2424
public class ServletConfig2 {

dev/io.openliberty.springboot.fat40_fat/fat/src/com/ibm/ws/springboot/support/fat/FATSuite.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
ExtractedAppTests40.class,
4545
GenerateWebServerPluginTests40.class,
4646
JakartaFeatureTests40.class,
47-
// MimeMapping40.class,
47+
MimeMapping40.class,
4848
ConfigSpringBootApplicationTagWarTests40.class,
4949
SpringBootUtilityThinTest.class,
5050
JSPTests40.class,
5151
MultiModuleProjectTests40.class,
52-
// ConfigActuatorXMLOverrideTests40.class,
52+
ConfigActuatorXMLOverrideTests40.class,
5353
CommonWebFluxTests40.class,
5454
NoServletRequiredAppTests40.class,
55-
// MultiContextTests40.class,
55+
MultiContextTests40.class,
5656
WebAnnotationTests40.class,
5757
WebSocketSpringBootAppTests40.class,
5858
// WebSocketWebAppTests40.class,

0 commit comments

Comments
 (0)