Browse Source

Make 'org.springframework.boot.ssl` a foundational package

Closes gh-47219
pull/47229/head
Phillip Webb 3 months ago
parent
commit
eeac38b70b
  1. 1
      config/checkstyle/checkstyle-suppressions.xml
  2. 5
      config/checkstyle/import-control.xml
  3. 14
      core/spring-boot/src/main/java/org/springframework/boot/ssl/FixedTrustManagerFactory.java
  4. 37
      core/spring-boot/src/main/javaTemplates/org/springframework/boot/ssl/SpringBootProviderVersion.java

1
config/checkstyle/checkstyle-suppressions.xml

@ -63,6 +63,7 @@ @@ -63,6 +63,7 @@
<suppress files="AbstractLaunchScriptIntegrationTests" checks="IllegalImport" />
<suppress files="FailureAnalyzers\.java" checks="RedundantModifier" />
<suppress files="SpringBootVersion" checks="JavadocPackage" />
<suppress files="SpringBootProviderVersion" checks="JavadocPackage" />
<suppress files="spring-boot-configuration-processor[\\/]src[\\/]test[\\/]java[\\/]org[\\/]springframework[\\/]boot[\\/]configurationsample[\\/]" checks="SpringDeprecatedCheck"/>
<suppress files="ImportTestcontainersTests\.java" checks="InterfaceIsType" />
<suppress files="MyContainers\.java" checks="InterfaceIsType" />

5
config/checkstyle/import-control.xml

@ -13,6 +13,11 @@ @@ -13,6 +13,11 @@
<!-- Allow other imports -->
<allow pkg=".*" regex="true" />
<!-- Keep foundation packages away from SpringApplication package -->
<subpackage name="ssl">
<disallow pkg="org.springframework.boot" exact-match="true"/>
</subpackage>
<!-- Open direct use of micrometer to specific subpackages -->
<subpackage name="metrics">
<allow pkg="io.micrometer" />

14
core/spring-boot/src/main/java/org/springframework/boot/ssl/FixedTrustManagerFactory.java

@ -24,8 +24,6 @@ import javax.net.ssl.TrustManager; @@ -24,8 +24,6 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.TrustManagerFactorySpi;
import org.springframework.boot.SpringBootVersion;
/**
* {@link TrustManagerFactory} which uses a fixed set of {@link TrustManager
* TrustManagers}.
@ -34,9 +32,7 @@ import org.springframework.boot.SpringBootVersion; @@ -34,9 +32,7 @@ import org.springframework.boot.SpringBootVersion;
*/
final class FixedTrustManagerFactory extends TrustManagerFactory {
private static final Provider PROVIDER = new Provider("FixedTrustManagerFactory", SpringBootVersion.getVersion(),
"") {
};
private static final Provider PROVIDER = new FixedTrustManagerFactoryProvider();
private FixedTrustManagerFactory(FixedTrustManagersSpi spi, String algorithm) {
super(spi, PROVIDER, algorithm);
@ -70,4 +66,12 @@ final class FixedTrustManagerFactory extends TrustManagerFactory { @@ -70,4 +66,12 @@ final class FixedTrustManagerFactory extends TrustManagerFactory {
}
private static class FixedTrustManagerFactoryProvider extends Provider {
FixedTrustManagerFactoryProvider() {
super("FixedTrustManagerFactory", SpringBootProviderVersion.get(), "");
}
}
}

37
core/spring-boot/src/main/javaTemplates/org/springframework/boot/ssl/SpringBootProviderVersion.java

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
/*
* Copyright 2012-present 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.boot.ssl;
/**
* Exposes the Spring Boot version for SSL Provider use.
*
* @author Phillip Webb
*/
final class SpringBootProviderVersion {
private SpringBootProviderVersion() {
}
/**
* Return the full version string of the present Spring Boot codebase.
* @return the version of Spring Boot
*/
static String get() {
return "${springBootVersion}";
}
}
Loading…
Cancel
Save