Merge branch '3.2.x' into 3.3.x

Closes gh-41613
This commit is contained in:
Andy Wilkinson 2024-07-25 16:15:44 +01:00
commit c642f6d268
69 changed files with 279 additions and 302 deletions

View File

@ -35,7 +35,6 @@ import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint; import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints; import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.health.HealthEndpoint;
import org.springframework.boot.actuate.health.HealthEndpointWebExtension; import org.springframework.boot.actuate.health.HealthEndpointWebExtension;
import org.springframework.boot.actuate.info.GitInfoContributor; import org.springframework.boot.actuate.info.GitInfoContributor;
@ -114,7 +113,8 @@ public class CloudFoundryActuatorAutoConfiguration {
@SuppressWarnings("removal") @SuppressWarnings("removal")
public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServletHandlerMapping( public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServletHandlerMapping(
ParameterValueMapper parameterMapper, EndpointMediaTypes endpointMediaTypes, ParameterValueMapper parameterMapper, EndpointMediaTypes endpointMediaTypes,
RestTemplateBuilder restTemplateBuilder, ServletEndpointsSupplier servletEndpointsSupplier, RestTemplateBuilder restTemplateBuilder,
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
ControllerEndpointsSupplier controllerEndpointsSupplier, ApplicationContext applicationContext) { ControllerEndpointsSupplier controllerEndpointsSupplier, ApplicationContext applicationContext) {
CloudFoundryWebEndpointDiscoverer discoverer = new CloudFoundryWebEndpointDiscoverer(applicationContext, CloudFoundryWebEndpointDiscoverer discoverer = new CloudFoundryWebEndpointDiscoverer(applicationContext,
parameterMapper, endpointMediaTypes, null, Collections.emptyList(), Collections.emptyList()); parameterMapper, endpointMediaTypes, null, Collections.emptyList(), Collections.emptyList());

View File

@ -20,9 +20,6 @@ import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter; import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter;
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint;
import org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
@ -48,22 +45,26 @@ public class ServletEndpointManagementContextConfiguration {
@Bean @Bean
@SuppressWarnings("removal") @SuppressWarnings("removal")
public IncludeExcludeEndpointFilter<ExposableServletEndpoint> servletExposeExcludePropertyEndpointFilter( public IncludeExcludeEndpointFilter<org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint> servletExposeExcludePropertyEndpointFilter(
WebEndpointProperties properties) { WebEndpointProperties properties) {
WebEndpointProperties.Exposure exposure = properties.getExposure(); WebEndpointProperties.Exposure exposure = properties.getExposure();
return new IncludeExcludeEndpointFilter<>(ExposableServletEndpoint.class, exposure.getInclude(), return new IncludeExcludeEndpointFilter<>(
org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint.class, exposure.getInclude(),
exposure.getExclude()); exposure.getExclude());
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass(DispatcherServlet.class) @ConditionalOnClass(DispatcherServlet.class)
@SuppressWarnings("removal")
public static class WebMvcServletEndpointManagementContextConfiguration { public static class WebMvcServletEndpointManagementContextConfiguration {
@Bean @Bean
public ServletEndpointRegistrar servletEndpointRegistrar(WebEndpointProperties properties, @SuppressWarnings({ "deprecation", "removal" })
ServletEndpointsSupplier servletEndpointsSupplier, DispatcherServletPath dispatcherServletPath) { public org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar servletEndpointRegistrar(
return new ServletEndpointRegistrar(dispatcherServletPath.getRelativePath(properties.getBasePath()), WebEndpointProperties properties,
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
DispatcherServletPath dispatcherServletPath) {
return new org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar(
dispatcherServletPath.getRelativePath(properties.getBasePath()),
servletEndpointsSupplier.getEndpoints()); servletEndpointsSupplier.getEndpoints());
} }
@ -72,13 +73,16 @@ public class ServletEndpointManagementContextConfiguration {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass(ResourceConfig.class) @ConditionalOnClass(ResourceConfig.class)
@ConditionalOnMissingClass("org.springframework.web.servlet.DispatcherServlet") @ConditionalOnMissingClass("org.springframework.web.servlet.DispatcherServlet")
@SuppressWarnings("removal")
public static class JerseyServletEndpointManagementContextConfiguration { public static class JerseyServletEndpointManagementContextConfiguration {
@Bean @Bean
public ServletEndpointRegistrar servletEndpointRegistrar(WebEndpointProperties properties, @SuppressWarnings({ "deprecation", "removal" })
ServletEndpointsSupplier servletEndpointsSupplier, JerseyApplicationPath jerseyApplicationPath) { public org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar servletEndpointRegistrar(
return new ServletEndpointRegistrar(jerseyApplicationPath.getRelativePath(properties.getBasePath()), WebEndpointProperties properties,
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
JerseyApplicationPath jerseyApplicationPath) {
return new org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar(
jerseyApplicationPath.getRelativePath(properties.getBasePath()),
servletEndpointsSupplier.getEndpoints()); servletEndpointsSupplier.getEndpoints());
} }

View File

@ -29,16 +29,12 @@ import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.invoke.OperationInvokerAdvisor; import org.springframework.boot.actuate.endpoint.invoke.OperationInvokerAdvisor;
import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper; import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper;
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes; import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint; import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints; import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
import org.springframework.boot.actuate.endpoint.web.PathMapper; import org.springframework.boot.actuate.endpoint.web.PathMapper;
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint; import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer; import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -96,10 +92,12 @@ public class WebEndpointAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(ControllerEndpointsSupplier.class) @ConditionalOnMissingBean(ControllerEndpointsSupplier.class)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
public ControllerEndpointDiscoverer controllerEndpointDiscoverer(ObjectProvider<PathMapper> endpointPathMappers, public org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer controllerEndpointDiscoverer(
ObjectProvider<PathMapper> endpointPathMappers,
ObjectProvider<Collection<EndpointFilter<ExposableControllerEndpoint>>> filters) { ObjectProvider<Collection<EndpointFilter<ExposableControllerEndpoint>>> filters) {
return new ControllerEndpointDiscoverer(this.applicationContext, endpointPathMappers.orderedStream().toList(), return new org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer(
this.applicationContext, endpointPathMappers.orderedStream().toList(),
filters.getIfAvailable(Collections::emptyList)); filters.getIfAvailable(Collections::emptyList));
} }
@ -125,16 +123,16 @@ public class WebEndpointAutoConfiguration {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication(type = Type.SERVLET) @ConditionalOnWebApplication(type = Type.SERVLET)
@SuppressWarnings("removal")
static class WebEndpointServletConfiguration { static class WebEndpointServletConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(ServletEndpointsSupplier.class) @SuppressWarnings({ "deprecation", "removal" })
ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext, @ConditionalOnMissingBean(org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier.class)
ObjectProvider<PathMapper> endpointPathMappers, org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer servletEndpointDiscoverer(
ObjectProvider<EndpointFilter<ExposableServletEndpoint>> filters) { ApplicationContext applicationContext, ObjectProvider<PathMapper> endpointPathMappers,
return new ServletEndpointDiscoverer(applicationContext, endpointPathMappers.orderedStream().toList(), ObjectProvider<EndpointFilter<org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint>> filters) {
filters.orderedStream().toList()); return new org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer(
applicationContext, endpointPathMappers.orderedStream().toList(), filters.orderedStream().toList());
} }
} }

View File

@ -45,11 +45,9 @@ import org.springframework.boot.actuate.endpoint.jackson.EndpointObjectMapper;
import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver; import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
import org.springframework.boot.actuate.endpoint.web.EndpointMapping; import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes; import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint; import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.WebServerNamespace; import org.springframework.boot.actuate.endpoint.web.WebServerNamespace;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.jersey.JerseyEndpointResourceFactory; import org.springframework.boot.actuate.endpoint.web.jersey.JerseyEndpointResourceFactory;
import org.springframework.boot.actuate.endpoint.web.jersey.JerseyHealthEndpointAdditionalPathResourceFactory; import org.springframework.boot.actuate.endpoint.web.jersey.JerseyHealthEndpointAdditionalPathResourceFactory;
import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.health.HealthEndpoint;
@ -86,7 +84,8 @@ class JerseyWebEndpointManagementContextConfiguration {
@Bean @Bean
@SuppressWarnings("removal") @SuppressWarnings("removal")
JerseyWebEndpointsResourcesRegistrar jerseyWebEndpointsResourcesRegistrar(Environment environment, JerseyWebEndpointsResourcesRegistrar jerseyWebEndpointsResourcesRegistrar(Environment environment,
WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, WebEndpointsSupplier webEndpointsSupplier,
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
EndpointMediaTypes endpointMediaTypes, WebEndpointProperties webEndpointProperties) { EndpointMediaTypes endpointMediaTypes, WebEndpointProperties webEndpointProperties) {
String basePath = webEndpointProperties.getBasePath(); String basePath = webEndpointProperties.getBasePath();
boolean shouldRegisterLinks = shouldRegisterLinksMapping(webEndpointProperties, environment, basePath); boolean shouldRegisterLinks = shouldRegisterLinksMapping(webEndpointProperties, environment, basePath);
@ -130,7 +129,7 @@ class JerseyWebEndpointManagementContextConfiguration {
private final WebEndpointsSupplier webEndpointsSupplier; private final WebEndpointsSupplier webEndpointsSupplier;
private final ServletEndpointsSupplier servletEndpointsSupplier; private final org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier;
private final EndpointMediaTypes mediaTypes; private final EndpointMediaTypes mediaTypes;
@ -139,8 +138,8 @@ class JerseyWebEndpointManagementContextConfiguration {
private final boolean shouldRegisterLinks; private final boolean shouldRegisterLinks;
JerseyWebEndpointsResourcesRegistrar(WebEndpointsSupplier webEndpointsSupplier, JerseyWebEndpointsResourcesRegistrar(WebEndpointsSupplier webEndpointsSupplier,
ServletEndpointsSupplier servletEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
String basePath, boolean shouldRegisterLinks) { EndpointMediaTypes endpointMediaTypes, String basePath, boolean shouldRegisterLinks) {
this.webEndpointsSupplier = webEndpointsSupplier; this.webEndpointsSupplier = webEndpointsSupplier;
this.servletEndpointsSupplier = servletEndpointsSupplier; this.servletEndpointsSupplier = servletEndpointsSupplier;
this.mediaTypes = endpointMediaTypes; this.mediaTypes = endpointMediaTypes;
@ -155,7 +154,8 @@ class JerseyWebEndpointManagementContextConfiguration {
private void register(ResourceConfig config) { private void register(ResourceConfig config) {
Collection<ExposableWebEndpoint> webEndpoints = this.webEndpointsSupplier.getEndpoints(); Collection<ExposableWebEndpoint> webEndpoints = this.webEndpointsSupplier.getEndpoints();
Collection<ExposableServletEndpoint> servletEndpoints = this.servletEndpointsSupplier.getEndpoints(); Collection<org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint> servletEndpoints = this.servletEndpointsSupplier
.getEndpoints();
EndpointLinksResolver linksResolver = getLinksResolver(webEndpoints, servletEndpoints); EndpointLinksResolver linksResolver = getLinksResolver(webEndpoints, servletEndpoints);
EndpointMapping mapping = new EndpointMapping(this.basePath); EndpointMapping mapping = new EndpointMapping(this.basePath);
Collection<Resource> endpointResources = new JerseyEndpointResourceFactory().createEndpointResources( Collection<Resource> endpointResources = new JerseyEndpointResourceFactory().createEndpointResources(
@ -164,7 +164,7 @@ class JerseyWebEndpointManagementContextConfiguration {
} }
private EndpointLinksResolver getLinksResolver(Collection<ExposableWebEndpoint> webEndpoints, private EndpointLinksResolver getLinksResolver(Collection<ExposableWebEndpoint> webEndpoints,
Collection<ExposableServletEndpoint> servletEndpoints) { Collection<org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint> servletEndpoints) {
List<ExposableEndpoint<?>> endpoints = new ArrayList<>(webEndpoints.size() + servletEndpoints.size()); List<ExposableEndpoint<?>> endpoints = new ArrayList<>(webEndpoints.size() + servletEndpoints.size());
endpoints.addAll(webEndpoints); endpoints.addAll(webEndpoints);
endpoints.addAll(servletEndpoints); endpoints.addAll(servletEndpoints);

View File

@ -43,7 +43,6 @@ import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.WebServerNamespace; import org.springframework.boot.actuate.endpoint.web.WebServerNamespace;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.servlet.AdditionalHealthEndpointPathsWebMvcHandlerMapping; import org.springframework.boot.actuate.endpoint.web.servlet.AdditionalHealthEndpointPathsWebMvcHandlerMapping;
import org.springframework.boot.actuate.endpoint.web.servlet.ControllerEndpointHandlerMapping; import org.springframework.boot.actuate.endpoint.web.servlet.ControllerEndpointHandlerMapping;
import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping; import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping;
@ -84,9 +83,10 @@ public class WebMvcEndpointManagementContextConfiguration {
@ConditionalOnMissingBean @ConditionalOnMissingBean
@SuppressWarnings("removal") @SuppressWarnings("removal")
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier,
ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier servletEndpointsSupplier,
EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes,
WebEndpointProperties webEndpointProperties, Environment environment) { CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties,
Environment environment) {
List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>(); List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints(); Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
allEndpoints.addAll(webEndpoints); allEndpoints.addAll(webEndpoints);

View File

@ -29,7 +29,6 @@ import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfigu
import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport;
import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration;
import org.springframework.boot.actuate.metrics.export.prometheus.PrometheusScrapeEndpoint; import org.springframework.boot.actuate.metrics.export.prometheus.PrometheusScrapeEndpoint;
import org.springframework.boot.actuate.metrics.export.prometheus.PrometheusSimpleclientScrapeEndpoint;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@ -81,7 +80,8 @@ public class PrometheusMetricsExportAutoConfiguration {
@SuppressWarnings("removal") @SuppressWarnings("removal")
@Bean @Bean
@ConditionalOnMissingBean({ PrometheusScrapeEndpoint.class, PrometheusSimpleclientScrapeEndpoint.class }) @ConditionalOnMissingBean({ PrometheusScrapeEndpoint.class,
org.springframework.boot.actuate.metrics.export.prometheus.PrometheusSimpleclientScrapeEndpoint.class })
PrometheusScrapeEndpoint prometheusEndpoint(PrometheusRegistry prometheusRegistry, PrometheusScrapeEndpoint prometheusEndpoint(PrometheusRegistry prometheusRegistry,
PrometheusConfig prometheusConfig) { PrometheusConfig prometheusConfig) {
return new PrometheusScrapeEndpoint(prometheusRegistry, prometheusConfig.prometheusProperties()); return new PrometheusScrapeEndpoint(prometheusRegistry, prometheusConfig.prometheusProperties());

View File

@ -68,12 +68,6 @@ abstract class HttpSender extends BaseHttpSender<URI, byte[]> {
postSpans(endpoint, headers, body); postSpans(endpoint, headers, body);
} }
/**
* This will send span(s) as a POST to a zipkin endpoint.
* @param endpoint the POST endpoint. For example, http://localhost:9411/api/v2/spans.
* @param headers headers for the POST request
* @param body list of possibly gzipped, encoded spans.
*/
abstract void postSpans(URI endpoint, HttpHeaders headers, byte[] body) throws IOException; abstract void postSpans(URI endpoint, HttpHeaders headers, byte[] body) throws IOException;
HttpHeaders getDefaultHeaders() { HttpHeaders getDefaultHeaders() {

View File

@ -94,7 +94,7 @@ class ZipkinConfigurations {
@Bean @Bean
@ConditionalOnMissingBean(BytesMessageSender.class) @ConditionalOnMissingBean(BytesMessageSender.class)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
ZipkinRestTemplateSender restTemplateSender(ZipkinProperties properties, Encoding encoding, ZipkinRestTemplateSender restTemplateSender(ZipkinProperties properties, Encoding encoding,
ObjectProvider<ZipkinRestTemplateBuilderCustomizer> customizers, ObjectProvider<ZipkinRestTemplateBuilderCustomizer> customizers,
ObjectProvider<ZipkinConnectionDetails> connectionDetailsProvider, ObjectProvider<ZipkinConnectionDetails> connectionDetailsProvider,
@ -111,7 +111,7 @@ class ZipkinConfigurations {
restTemplateBuilder.build()); restTemplateBuilder.build());
} }
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
private RestTemplateBuilder applyCustomizers(RestTemplateBuilder restTemplateBuilder, private RestTemplateBuilder applyCustomizers(RestTemplateBuilder restTemplateBuilder,
ObjectProvider<ZipkinRestTemplateBuilderCustomizer> customizers) { ObjectProvider<ZipkinRestTemplateBuilderCustomizer> customizers) {
Iterable<ZipkinRestTemplateBuilderCustomizer> orderedCustomizers = () -> customizers.orderedStream() Iterable<ZipkinRestTemplateBuilderCustomizer> orderedCustomizers = () -> customizers.orderedStream()
@ -132,7 +132,7 @@ class ZipkinConfigurations {
@Bean @Bean
@ConditionalOnMissingBean(BytesMessageSender.class) @ConditionalOnMissingBean(BytesMessageSender.class)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
ZipkinWebClientSender webClientSender(ZipkinProperties properties, Encoding encoding, ZipkinWebClientSender webClientSender(ZipkinProperties properties, Encoding encoding,
ObjectProvider<ZipkinWebClientBuilderCustomizer> customizers, ObjectProvider<ZipkinWebClientBuilderCustomizer> customizers,
ObjectProvider<ZipkinConnectionDetails> connectionDetailsProvider, ObjectProvider<ZipkinConnectionDetails> connectionDetailsProvider,

View File

@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.tracing.zipkin; package org.springframework.boot.actuate.autoconfigure.tracing.zipkin;
import zipkin2.reporter.HttpEndpointSupplier; import zipkin2.reporter.HttpEndpointSupplier.Factory;
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails; import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
@ -24,7 +24,7 @@ import org.springframework.boot.autoconfigure.service.connection.ConnectionDetai
* Details required to establish a connection to a Zipkin server. * Details required to establish a connection to a Zipkin server.
* <p> * <p>
* Note: {@linkplain #getSpanEndpoint()} is only read once and passed to a bean of type * Note: {@linkplain #getSpanEndpoint()} is only read once and passed to a bean of type
* {@link HttpEndpointSupplier.Factory} which defaults to no-op (constant). * {@link Factory HttpEndpointSupplier.Factory} which defaults to no-op (constant).
* *
* @author Moritz Halbritter * @author Moritz Halbritter
* @since 3.1.0 * @since 3.1.0

View File

@ -16,11 +16,11 @@
package org.springframework.boot.actuate.autoconfigure.tracing.zipkin; package org.springframework.boot.actuate.autoconfigure.tracing.zipkin;
import java.net.http.HttpClient; import java.net.http.HttpClient.Builder;
/** /**
* Callback interface that can be implemented by beans wishing to customize the * Callback interface that can be implemented by beans wishing to customize the
* {@link HttpClient.Builder} used to send spans to Zipkin. * {@link Builder HttpClient.Builder} used to send spans to Zipkin.
* *
* @author Moritz Halbritter * @author Moritz Halbritter
* @since 3.3.0 * @since 3.3.0
@ -32,6 +32,6 @@ public interface ZipkinHttpClientBuilderCustomizer {
* Customize the http client builder. * Customize the http client builder.
* @param httpClient the http client builder to customize * @param httpClient the http client builder to customize
*/ */
void customize(HttpClient.Builder httpClient); void customize(Builder httpClient);
} }

View File

@ -31,8 +31,6 @@ import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint; import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint; import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint;
import org.springframework.boot.actuate.endpoint.web.PathMapper; import org.springframework.boot.actuate.endpoint.web.PathMapper;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer;
import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer; import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@ -98,7 +96,8 @@ class WebEndpointAutoConfigurationTests {
@SuppressWarnings("removal") @SuppressWarnings("removal")
void webApplicationConfiguresEndpointDiscoverer() { void webApplicationConfiguresEndpointDiscoverer() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
assertThat(context).hasSingleBean(ControllerEndpointDiscoverer.class); assertThat(context).hasSingleBean(
org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer.class);
assertThat(context).hasSingleBean(WebEndpointDiscoverer.class); assertThat(context).hasSingleBean(WebEndpointDiscoverer.class);
}); });
} }
@ -112,14 +111,16 @@ class WebEndpointAutoConfigurationTests {
@Test @Test
@SuppressWarnings("removal") @SuppressWarnings("removal")
void contextShouldConfigureServletEndpointDiscoverer() { void contextShouldConfigureServletEndpointDiscoverer() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ServletEndpointDiscoverer.class)); this.contextRunner.run((context) -> assertThat(context)
.hasSingleBean(org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer.class));
} }
@Test @Test
@SuppressWarnings("removal") @SuppressWarnings("removal")
void contextWhenNotServletShouldNotConfigureServletEndpointDiscoverer() { void contextWhenNotServletShouldNotConfigureServletEndpointDiscoverer() {
new ApplicationContextRunner().withConfiguration(CONFIGURATIONS) new ApplicationContextRunner().withConfiguration(CONFIGURATIONS)
.run((context) -> assertThat(context).doesNotHaveBean(ServletEndpointDiscoverer.class)); .run((context) -> assertThat(context).doesNotHaveBean(
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer.class));
} }
@Component @Component

View File

@ -22,7 +22,6 @@ import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.exporter.common.TextFormat; import io.prometheus.client.exporter.common.TextFormat;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.metrics.export.prometheus.PrometheusSimpleclientScrapeEndpoint;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
@ -36,7 +35,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
/** /**
* Tests for generating documentation describing the * Tests for generating documentation describing the
* {@link PrometheusSimpleclientScrapeEndpoint}. * {@link org.springframework.boot.actuate.metrics.export.prometheus.PrometheusSimpleclientScrapeEndpoint}.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
* @author Johnny Lim * @author Johnny Lim
@ -76,12 +75,13 @@ class PrometheusSimpleclientScrapeEndpointDocumentationTests extends MockMvcEndp
@Bean @Bean
@SuppressWarnings({ "removal", "deprecation" }) @SuppressWarnings({ "removal", "deprecation" })
PrometheusSimpleclientScrapeEndpoint endpoint() { org.springframework.boot.actuate.metrics.export.prometheus.PrometheusSimpleclientScrapeEndpoint endpoint() {
CollectorRegistry collectorRegistry = new CollectorRegistry(true); CollectorRegistry collectorRegistry = new CollectorRegistry(true);
io.micrometer.prometheus.PrometheusMeterRegistry meterRegistry = new io.micrometer.prometheus.PrometheusMeterRegistry( io.micrometer.prometheus.PrometheusMeterRegistry meterRegistry = new io.micrometer.prometheus.PrometheusMeterRegistry(
(key) -> null, collectorRegistry, Clock.SYSTEM); (key) -> null, collectorRegistry, Clock.SYSTEM);
new JvmMemoryMetrics().bindTo(meterRegistry); new JvmMemoryMetrics().bindTo(meterRegistry);
return new PrometheusSimpleclientScrapeEndpoint(collectorRegistry); return new org.springframework.boot.actuate.metrics.export.prometheus.PrometheusSimpleclientScrapeEndpoint(
collectorRegistry);
} }
} }

View File

@ -25,8 +25,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
@ -52,8 +50,9 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/** /**
* Integration tests for the Actuator's MVC {@link ControllerEndpoint controller * Integration tests for the Actuator's MVC
* endpoints}. * {@link org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint
* controller endpoints}.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
@ -120,7 +119,7 @@ class ControllerEndpointWebMvcIntegrationTests {
} }
@RestControllerEndpoint(id = "example") @org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint(id = "example")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class ExampleController { static class ExampleController {

View File

@ -30,8 +30,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration; import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration;
@ -160,13 +158,13 @@ class JerseyEndpointIntegrationTests {
return autoconfigurations.toArray(new Class<?>[0]); return autoconfigurations.toArray(new Class<?>[0]);
} }
@ControllerEndpoint(id = "controller") @org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint(id = "controller")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class TestControllerEndpoint { static class TestControllerEndpoint {
} }
@RestControllerEndpoint(id = "restcontroller") @org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint(id = "restcontroller")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class TestRestControllerEndpoint { static class TestRestControllerEndpoint {

View File

@ -25,8 +25,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.reactive.ReactiveManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.reactive.ReactiveManagementContextAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration; import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
@ -107,13 +105,13 @@ class WebFluxEndpointIntegrationTests {
.build(); .build();
} }
@ControllerEndpoint(id = "controller") @org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint(id = "controller")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class TestControllerEndpoint { static class TestControllerEndpoint {
} }
@RestControllerEndpoint(id = "restcontroller") @org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint(id = "restcontroller")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class TestRestControllerEndpoint { static class TestRestControllerEndpoint {

View File

@ -33,9 +33,6 @@ import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAu
import org.springframework.boot.actuate.autoconfigure.web.exchanges.HttpExchangesAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.exchanges.HttpExchangesAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.web.EndpointServlet;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository; import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
@ -189,7 +186,7 @@ class WebMvcEndpointExposureIntegrationTests {
String.format("Unexpected %s HTTP status for endpoint %s", result.getStatus(), path)); String.format("Unexpected %s HTTP status for endpoint %s", result.getStatus(), path));
} }
@RestControllerEndpoint(id = "custommvc") @org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint(id = "custommvc")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class CustomMvcEndpoint { static class CustomMvcEndpoint {
@ -200,13 +197,14 @@ class WebMvcEndpointExposureIntegrationTests {
} }
@ServletEndpoint(id = "customservlet") @org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint(id = "customservlet")
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
static class CustomServletEndpoint implements Supplier<EndpointServlet> { static class CustomServletEndpoint
implements Supplier<org.springframework.boot.actuate.endpoint.web.EndpointServlet> {
@Override @Override
public EndpointServlet get() { public org.springframework.boot.actuate.endpoint.web.EndpointServlet get() {
return new EndpointServlet(new HttpServlet() { return new org.springframework.boot.actuate.endpoint.web.EndpointServlet(new HttpServlet() {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) protected void doGet(HttpServletRequest req, HttpServletResponse resp)

View File

@ -28,10 +28,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.web.EndpointServlet;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping; import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
@ -197,25 +193,26 @@ class WebMvcEndpointIntegrationTests {
} }
@ServletEndpoint(id = "servlet") @org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint(id = "servlet")
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
static class TestServletEndpoint implements Supplier<EndpointServlet> { static class TestServletEndpoint
implements Supplier<org.springframework.boot.actuate.endpoint.web.EndpointServlet> {
@Override @Override
public EndpointServlet get() { public org.springframework.boot.actuate.endpoint.web.EndpointServlet get() {
return new EndpointServlet(new HttpServlet() { return new org.springframework.boot.actuate.endpoint.web.EndpointServlet(new HttpServlet() {
}); });
} }
} }
@ControllerEndpoint(id = "controller") @org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint(id = "controller")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class TestControllerEndpoint { static class TestControllerEndpoint {
} }
@RestControllerEndpoint(id = "restcontroller") @org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint(id = "restcontroller")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class TestRestControllerEndpoint { static class TestRestControllerEndpoint {

View File

@ -30,7 +30,6 @@ import org.springframework.boot.actuate.endpoint.Operation;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint; import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints; import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
import org.springframework.context.support.StaticApplicationContext; import org.springframework.context.support.StaticApplicationContext;
import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.http.server.reactive.ServerHttpResponse;
@ -354,7 +353,7 @@ class EndpointRequestTests {
} }
@ServletEndpoint(id = "baz") @org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint(id = "baz")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class BazServletEndpoint { static class BazServletEndpoint {

View File

@ -32,8 +32,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.web.EndpointServlet;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
@ -177,13 +175,14 @@ abstract class AbstractEndpointRequestIntegrationTests {
} }
@ServletEndpoint(id = "se1") @org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint(id = "se1")
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
static class TestServletEndpoint implements Supplier<EndpointServlet> { static class TestServletEndpoint
implements Supplier<org.springframework.boot.actuate.endpoint.web.EndpointServlet> {
@Override @Override
public EndpointServlet get() { public org.springframework.boot.actuate.endpoint.web.EndpointServlet get() {
return new EndpointServlet(ExampleServlet.class); return new org.springframework.boot.actuate.endpoint.web.EndpointServlet(ExampleServlet.class);
} }
} }

View File

@ -31,7 +31,6 @@ import org.springframework.boot.actuate.endpoint.Operation;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint; import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint;
import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints; import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
import org.springframework.boot.autoconfigure.security.servlet.RequestMatcherProvider; import org.springframework.boot.autoconfigure.security.servlet.RequestMatcherProvider;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockServletContext; import org.springframework.mock.web.MockServletContext;
@ -353,7 +352,7 @@ class EndpointRequestTests {
} }
@ServletEndpoint(id = "baz") @org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint(id = "baz")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class BazServletEndpoint { static class BazServletEndpoint {

View File

@ -34,7 +34,7 @@ import static org.mockito.Mockito.mock;
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class LazyTracingSpanContextSupplierTests { class LazyTracingSpanContextSupplierTests {
private final Tracer tracer = mock(Tracer.class); private final Tracer tracer = mock(Tracer.class);

View File

@ -50,7 +50,7 @@ import static org.mockito.Mockito.mock;
* *
* @author Moritz Halbritter * @author Moritz Halbritter
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ZipkinConfigurationsSenderConfigurationTests { class ZipkinConfigurationsSenderConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()

View File

@ -17,7 +17,6 @@
package org.springframework.boot.actuate.autoconfigure.tracing.zipkin; package org.springframework.boot.actuate.autoconfigure.tracing.zipkin;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import java.time.Duration; import java.time.Duration;
import java.util.Base64; import java.util.Base64;
@ -36,8 +35,6 @@ import zipkin2.reporter.Encoding;
import zipkin2.reporter.HttpEndpointSupplier; import zipkin2.reporter.HttpEndpointSupplier;
import zipkin2.reporter.HttpEndpointSuppliers; import zipkin2.reporter.HttpEndpointSuppliers;
import org.springframework.http.HttpHeaders;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatException; import static org.assertj.core.api.Assertions.assertThatException;
import static org.assertj.core.api.Assertions.assertThatIOException; import static org.assertj.core.api.Assertions.assertThatIOException;
@ -55,9 +52,14 @@ class ZipkinHttpClientSenderTests extends ZipkinHttpSenderTests {
@Override @Override
@BeforeEach @BeforeEach
void beforeEach() throws Exception { void beforeEach() {
this.mockBackEnd = new MockWebServer(); this.mockBackEnd = new MockWebServer();
this.mockBackEnd.start(); try {
this.mockBackEnd.start();
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
this.zipkinUrl = this.mockBackEnd.url("/api/v2/spans").toString(); this.zipkinUrl = this.mockBackEnd.url("/api/v2/spans").toString();
super.beforeEach(); super.beforeEach();
} }
@ -109,10 +111,6 @@ class ZipkinHttpClientSenderTests extends ZipkinHttpSenderTests {
}); });
} }
/**
* This tests that a dynamic {@linkplain HttpEndpointSupplier} updates are visible to
* {@link HttpSender#postSpans(URI, HttpHeaders, byte[])}.
*/
@Test @Test
void sendUsesDynamicEndpoint() throws Exception { void sendUsesDynamicEndpoint() throws Exception {
this.mockBackEnd.enqueue(new MockResponse()); this.mockBackEnd.enqueue(new MockResponse());

View File

@ -41,7 +41,7 @@ abstract class ZipkinHttpSenderTests {
abstract BytesMessageSender createSender(); abstract BytesMessageSender createSender();
@BeforeEach @BeforeEach
void beforeEach() throws Exception { void beforeEach() {
this.sender = createSender(); this.sender = createSender();
} }

View File

@ -17,7 +17,6 @@
package org.springframework.boot.actuate.autoconfigure.tracing.zipkin; package org.springframework.boot.actuate.autoconfigure.tracing.zipkin;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.util.Base64; import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -29,7 +28,6 @@ import zipkin2.reporter.Encoding;
import zipkin2.reporter.HttpEndpointSupplier; import zipkin2.reporter.HttpEndpointSupplier;
import zipkin2.reporter.HttpEndpointSuppliers; import zipkin2.reporter.HttpEndpointSuppliers;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.test.web.client.MockRestServiceServer;
@ -48,7 +46,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
* @author Moritz Halbritter * @author Moritz Halbritter
* @author Stefan Bratanov * @author Stefan Bratanov
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ZipkinRestTemplateSenderTests extends ZipkinHttpSenderTests { class ZipkinRestTemplateSenderTests extends ZipkinHttpSenderTests {
private static final String ZIPKIN_URL = "http://localhost:9411/api/v2/spans"; private static final String ZIPKIN_URL = "http://localhost:9411/api/v2/spans";
@ -101,10 +99,6 @@ class ZipkinRestTemplateSenderTests extends ZipkinHttpSenderTests {
} }
} }
/**
* This tests that a dynamic {@linkplain HttpEndpointSupplier} updates are visible to
* {@link HttpSender#postSpans(URI, HttpHeaders, byte[])}.
*/
@Test @Test
void sendUsesDynamicEndpoint() throws Exception { void sendUsesDynamicEndpoint() throws Exception {
this.mockServer.expect(requestTo(ZIPKIN_URL + "/1")).andRespond(withStatus(HttpStatus.ACCEPTED)); this.mockServer.expect(requestTo(ZIPKIN_URL + "/1")).andRespond(withStatus(HttpStatus.ACCEPTED));

View File

@ -17,7 +17,6 @@
package org.springframework.boot.actuate.autoconfigure.tracing.zipkin; package org.springframework.boot.actuate.autoconfigure.tracing.zipkin;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.time.Duration; import java.time.Duration;
import java.util.Base64; import java.util.Base64;
import java.util.Collections; import java.util.Collections;
@ -39,7 +38,6 @@ import zipkin2.reporter.Encoding;
import zipkin2.reporter.HttpEndpointSupplier; import zipkin2.reporter.HttpEndpointSupplier;
import zipkin2.reporter.HttpEndpointSuppliers; import zipkin2.reporter.HttpEndpointSuppliers;
import org.springframework.http.HttpHeaders;
import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClient;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -50,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThatException;
* *
* @author Stefan Bratanov * @author Stefan Bratanov
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ZipkinWebClientSenderTests extends ZipkinHttpSenderTests { class ZipkinWebClientSenderTests extends ZipkinHttpSenderTests {
private static ClearableDispatcher dispatcher; private static ClearableDispatcher dispatcher;
@ -75,7 +73,7 @@ class ZipkinWebClientSenderTests extends ZipkinHttpSenderTests {
@Override @Override
@BeforeEach @BeforeEach
void beforeEach() throws Exception { void beforeEach() {
super.beforeEach(); super.beforeEach();
clearResponses(); clearResponses();
clearRequests(); clearRequests();
@ -122,10 +120,6 @@ class ZipkinWebClientSenderTests extends ZipkinHttpSenderTests {
}); });
} }
/**
* This tests that a dynamic {@linkplain HttpEndpointSupplier} updates are visible to
* {@link HttpSender#postSpans(URI, HttpHeaders, byte[])}.
*/
@Test @Test
void sendUsesDynamicEndpoint() throws Exception { void sendUsesDynamicEndpoint() throws Exception {
mockBackEnd.enqueue(new MockResponse()); mockBackEnd.enqueue(new MockResponse());
@ -180,10 +174,16 @@ class ZipkinWebClientSenderTests extends ZipkinHttpSenderTests {
assertThat(request).satisfies(assertions); assertThat(request).satisfies(assertions);
} }
private static void clearRequests() throws InterruptedException { private static void clearRequests() {
RecordedRequest request; RecordedRequest request;
do { do {
request = mockBackEnd.takeRequest(0, TimeUnit.SECONDS); try {
request = mockBackEnd.takeRequest(0, TimeUnit.SECONDS);
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new RuntimeException(ex);
}
} }
while (request != null); while (request != null);
} }

View File

@ -36,7 +36,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
@ -216,7 +215,7 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
} }
@RestControllerEndpoint(id = "failController") @org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint(id = "failController")
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class FailingControllerEndpoint { static class FailingControllerEndpoint {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,9 +24,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.springframework.boot.actuate.endpoint.web.EndpointMapping; import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint; import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.reactive.HandlerMapping; import org.springframework.web.reactive.HandlerMapping;
@ -35,9 +33,11 @@ import org.springframework.web.reactive.result.method.annotation.RequestMappingH
import org.springframework.web.util.pattern.PathPattern; import org.springframework.web.util.pattern.PathPattern;
/** /**
* {@link HandlerMapping} that exposes {@link ControllerEndpoint @ControllerEndpoint} and * {@link HandlerMapping} that exposes
* {@link RestControllerEndpoint @RestControllerEndpoint} annotated endpoints over Spring * {@link org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint @ControllerEndpoint}
* WebFlux. * and
* {@link org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint @RestControllerEndpoint}
* annotated endpoints over Spring WebFlux.
* *
* @author Phillip Webb * @author Phillip Webb
* @since 2.0.0 * @since 2.0.0

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,9 +25,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.springframework.boot.actuate.endpoint.web.EndpointMapping; import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint; import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.HandlerMapping;
@ -36,9 +34,11 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
import org.springframework.web.util.pattern.PathPattern; import org.springframework.web.util.pattern.PathPattern;
/** /**
* {@link HandlerMapping} that exposes {@link ControllerEndpoint @ControllerEndpoint} and * {@link HandlerMapping} that exposes
* {@link RestControllerEndpoint @RestControllerEndpoint} annotated endpoints over Spring * {@link org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint @ControllerEndpoint}
* MVC. * and
* {@link org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint @RestControllerEndpoint}
* annotated endpoints over Spring MVC.
* *
* @author Phillip Webb * @author Phillip Webb
* @since 2.0.0 * @since 2.0.0

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -46,6 +46,7 @@ public class JettyServerThreadPoolMetricsBinder extends AbstractJettyMetricsBind
} }
@Override @Override
@SuppressWarnings("resource")
protected void bindMetrics(Server server) { protected void bindMetrics(Server server) {
ThreadPool threadPool = server.getThreadPool(); ThreadPool threadPool = server.getThreadPool();
if (threadPool != null) { if (threadPool != null) {

View File

@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.entry;
* @author Phillip Webb * @author Phillip Webb
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class EndpointServletTests { class EndpointServletTests {
@Test @Test

View File

@ -48,7 +48,7 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
@ExtendWith(MockitoExtension.class) @ExtendWith(MockitoExtension.class)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ServletEndpointRegistrarTests { class ServletEndpointRegistrarTests {
@Mock @Mock

View File

@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Moritz Halbritter * @author Moritz Halbritter
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ControllerEndpointDiscovererTests { class ControllerEndpointDiscovererTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();

View File

@ -57,7 +57,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Moritz Halbritter * @author Moritz Halbritter
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ServletEndpointDiscovererTests { class ServletEndpointDiscovererTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();

View File

@ -58,7 +58,7 @@ import org.springframework.web.util.DefaultUriBuilderFactory;
* @author Phillip Webb * @author Phillip Webb
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ControllerEndpointHandlerMappingIntegrationTests { class ControllerEndpointHandlerMappingIntegrationTests {
private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner( private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner(

View File

@ -57,7 +57,7 @@ import org.springframework.web.util.DefaultUriBuilderFactory;
* @author Phillip Webb * @author Phillip Webb
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class ControllerEndpointHandlerMappingIntegrationTests { class ControllerEndpointHandlerMappingIntegrationTests {
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner( private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner(

View File

@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jon Schneider * @author Jon Schneider
* @author Johnny Lim * @author Johnny Lim
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class PrometheusSimpleclientScrapeEndpointIntegrationTests { class PrometheusSimpleclientScrapeEndpointIntegrationTests {
@WebEndpointTest @WebEndpointTest

View File

@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.pulsar;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.pulsar.client.api.PulsarClientException;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.testcontainers.containers.PulsarContainer; import org.testcontainers.containers.PulsarContainer;
import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Container;
@ -106,7 +105,7 @@ class PulsarAutoConfigurationIntegrationTests {
} }
@GetMapping("/hello") @GetMapping("/hello")
String sayHello() throws PulsarClientException { String sayHello() {
return "Hello World -> " + this.pulsarTemplate.send(TOPIC, "hello"); return "Hello World -> " + this.pulsarTemplate.send(TOPIC, "hello");
} }

View File

@ -43,7 +43,6 @@ import org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfigurati
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.PropertyMapper; import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException; import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
import org.springframework.boot.task.TaskSchedulerBuilder;
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder; import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
@ -171,13 +170,14 @@ public class IntegrationAutoConfiguration {
* scheduling explicitly. * scheduling explicitly.
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnBean(TaskSchedulerBuilder.class) @ConditionalOnBean(org.springframework.boot.task.TaskSchedulerBuilder.class)
@ConditionalOnMissingBean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME) @ConditionalOnMissingBean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
protected static class IntegrationTaskSchedulerConfiguration { protected static class IntegrationTaskSchedulerConfiguration {
@Bean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME) @Bean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)
public ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder taskSchedulerBuilder, public ThreadPoolTaskScheduler taskScheduler(
org.springframework.boot.task.TaskSchedulerBuilder taskSchedulerBuilder,
ObjectProvider<ThreadPoolTaskSchedulerBuilder> threadPoolTaskSchedulerBuilderProvider) { ObjectProvider<ThreadPoolTaskSchedulerBuilder> threadPoolTaskSchedulerBuilderProvider) {
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider
.getIfUnique(); .getIfUnique();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,6 @@ import java.util.List;
import org.apache.pulsar.client.admin.PulsarAdminBuilder; import org.apache.pulsar.client.admin.PulsarAdminBuilder;
import org.apache.pulsar.client.api.ClientBuilder; import org.apache.pulsar.client.api.ClientBuilder;
import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.api.Schema;
import org.apache.pulsar.common.schema.SchemaType; import org.apache.pulsar.common.schema.SchemaType;
@ -96,7 +95,7 @@ class PulsarConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
PulsarClient pulsarClient(PulsarClientFactory clientFactory) throws PulsarClientException { PulsarClient pulsarClient(PulsarClientFactory clientFactory) {
return clientFactory.createClient(); return clientFactory.createClient();
} }

View File

@ -24,8 +24,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnThreading;
import org.springframework.boot.autoconfigure.thread.Threading; import org.springframework.boot.autoconfigure.thread.Threading;
import org.springframework.boot.task.SimpleAsyncTaskExecutorBuilder; import org.springframework.boot.task.SimpleAsyncTaskExecutorBuilder;
import org.springframework.boot.task.SimpleAsyncTaskExecutorCustomizer; import org.springframework.boot.task.SimpleAsyncTaskExecutorCustomizer;
import org.springframework.boot.task.TaskExecutorBuilder;
import org.springframework.boot.task.TaskExecutorCustomizer;
import org.springframework.boot.task.ThreadPoolTaskExecutorBuilder; import org.springframework.boot.task.ThreadPoolTaskExecutorBuilder;
import org.springframework.boot.task.ThreadPoolTaskExecutorCustomizer; import org.springframework.boot.task.ThreadPoolTaskExecutorCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -49,7 +47,6 @@ class TaskExecutorConfigurations {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(Executor.class) @ConditionalOnMissingBean(Executor.class)
@SuppressWarnings("removal")
static class TaskExecutorConfiguration { static class TaskExecutorConfiguration {
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, @Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
@ -63,7 +60,9 @@ class TaskExecutorConfigurations {
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, @Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
AsyncAnnotationBeanPostProcessor.DEFAULT_TASK_EXECUTOR_BEAN_NAME }) AsyncAnnotationBeanPostProcessor.DEFAULT_TASK_EXECUTOR_BEAN_NAME })
@ConditionalOnThreading(Threading.PLATFORM) @ConditionalOnThreading(Threading.PLATFORM)
ThreadPoolTaskExecutor applicationTaskExecutor(TaskExecutorBuilder taskExecutorBuilder, @SuppressWarnings({ "deprecation", "removal" })
ThreadPoolTaskExecutor applicationTaskExecutor(
org.springframework.boot.task.TaskExecutorBuilder taskExecutorBuilder,
ObjectProvider<ThreadPoolTaskExecutorBuilder> threadPoolTaskExecutorBuilderProvider) { ObjectProvider<ThreadPoolTaskExecutorBuilder> threadPoolTaskExecutorBuilderProvider) {
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder = threadPoolTaskExecutorBuilderProvider ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder = threadPoolTaskExecutorBuilderProvider
.getIfUnique(); .getIfUnique();
@ -82,11 +81,11 @@ class TaskExecutorConfigurations {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
@Deprecated(since = "3.2.0", forRemoval = true) @Deprecated(since = "3.2.0", forRemoval = true)
TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties, org.springframework.boot.task.TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties,
ObjectProvider<TaskExecutorCustomizer> taskExecutorCustomizers, ObjectProvider<org.springframework.boot.task.TaskExecutorCustomizer> taskExecutorCustomizers,
ObjectProvider<TaskDecorator> taskDecorator) { ObjectProvider<TaskDecorator> taskDecorator) {
TaskExecutionProperties.Pool pool = properties.getPool(); TaskExecutionProperties.Pool pool = properties.getPool();
TaskExecutorBuilder builder = new TaskExecutorBuilder(); org.springframework.boot.task.TaskExecutorBuilder builder = new org.springframework.boot.task.TaskExecutorBuilder();
builder = builder.queueCapacity(pool.getQueueCapacity()); builder = builder.queueCapacity(pool.getQueueCapacity());
builder = builder.corePoolSize(pool.getCoreSize()); builder = builder.corePoolSize(pool.getCoreSize());
builder = builder.maxPoolSize(pool.getMaxSize()); builder = builder.maxPoolSize(pool.getMaxSize());
@ -104,14 +103,15 @@ class TaskExecutorConfigurations {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
static class ThreadPoolTaskExecutorBuilderConfiguration { static class ThreadPoolTaskExecutorBuilderConfiguration {
@Bean @Bean
@ConditionalOnMissingBean({ TaskExecutorBuilder.class, ThreadPoolTaskExecutorBuilder.class }) @ConditionalOnMissingBean({ org.springframework.boot.task.TaskExecutorBuilder.class,
ThreadPoolTaskExecutorBuilder.class })
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder(TaskExecutionProperties properties, ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder(TaskExecutionProperties properties,
ObjectProvider<ThreadPoolTaskExecutorCustomizer> threadPoolTaskExecutorCustomizers, ObjectProvider<ThreadPoolTaskExecutorCustomizer> threadPoolTaskExecutorCustomizers,
ObjectProvider<TaskExecutorCustomizer> taskExecutorCustomizers, ObjectProvider<org.springframework.boot.task.TaskExecutorCustomizer> taskExecutorCustomizers,
ObjectProvider<TaskDecorator> taskDecorator) { ObjectProvider<TaskDecorator> taskDecorator) {
TaskExecutionProperties.Pool pool = properties.getPool(); TaskExecutionProperties.Pool pool = properties.getPool();
ThreadPoolTaskExecutorBuilder builder = new ThreadPoolTaskExecutorBuilder(); ThreadPoolTaskExecutorBuilder builder = new ThreadPoolTaskExecutorBuilder();
@ -132,7 +132,8 @@ class TaskExecutorConfigurations {
return builder; return builder;
} }
private ThreadPoolTaskExecutorCustomizer adapt(TaskExecutorCustomizer customizer) { private ThreadPoolTaskExecutorCustomizer adapt(
org.springframework.boot.task.TaskExecutorCustomizer customizer) {
return customizer::customize; return customizer::customize;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,8 +25,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnThreading;
import org.springframework.boot.autoconfigure.thread.Threading; import org.springframework.boot.autoconfigure.thread.Threading;
import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder; import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder;
import org.springframework.boot.task.SimpleAsyncTaskSchedulerCustomizer; import org.springframework.boot.task.SimpleAsyncTaskSchedulerCustomizer;
import org.springframework.boot.task.TaskSchedulerBuilder;
import org.springframework.boot.task.TaskSchedulerCustomizer;
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder; import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
import org.springframework.boot.task.ThreadPoolTaskSchedulerCustomizer; import org.springframework.boot.task.ThreadPoolTaskSchedulerCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -47,7 +45,6 @@ class TaskSchedulingConfigurations {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnBean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME) @ConditionalOnBean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)
@ConditionalOnMissingBean({ TaskScheduler.class, ScheduledExecutorService.class }) @ConditionalOnMissingBean({ TaskScheduler.class, ScheduledExecutorService.class })
@SuppressWarnings("removal")
static class TaskSchedulerConfiguration { static class TaskSchedulerConfiguration {
@Bean(name = "taskScheduler") @Bean(name = "taskScheduler")
@ -57,8 +54,9 @@ class TaskSchedulingConfigurations {
} }
@Bean @Bean
@SuppressWarnings({ "deprecation", "removal" })
@ConditionalOnThreading(Threading.PLATFORM) @ConditionalOnThreading(Threading.PLATFORM)
ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder taskSchedulerBuilder, ThreadPoolTaskScheduler taskScheduler(org.springframework.boot.task.TaskSchedulerBuilder taskSchedulerBuilder,
ObjectProvider<ThreadPoolTaskSchedulerBuilder> threadPoolTaskSchedulerBuilderProvider) { ObjectProvider<ThreadPoolTaskSchedulerBuilder> threadPoolTaskSchedulerBuilderProvider) {
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider
.getIfUnique(); .getIfUnique();
@ -71,14 +69,14 @@ class TaskSchedulingConfigurations {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
static class TaskSchedulerBuilderConfiguration { static class TaskSchedulerBuilderConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
TaskSchedulerBuilder taskSchedulerBuilder(TaskSchedulingProperties properties, org.springframework.boot.task.TaskSchedulerBuilder taskSchedulerBuilder(TaskSchedulingProperties properties,
ObjectProvider<TaskSchedulerCustomizer> taskSchedulerCustomizers) { ObjectProvider<org.springframework.boot.task.TaskSchedulerCustomizer> taskSchedulerCustomizers) {
TaskSchedulerBuilder builder = new TaskSchedulerBuilder(); org.springframework.boot.task.TaskSchedulerBuilder builder = new org.springframework.boot.task.TaskSchedulerBuilder();
builder = builder.poolSize(properties.getPool().getSize()); builder = builder.poolSize(properties.getPool().getSize());
TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown(); TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown();
builder = builder.awaitTermination(shutdown.isAwaitTermination()); builder = builder.awaitTermination(shutdown.isAwaitTermination());
@ -91,14 +89,15 @@ class TaskSchedulingConfigurations {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
static class ThreadPoolTaskSchedulerBuilderConfiguration { static class ThreadPoolTaskSchedulerBuilderConfiguration {
@Bean @Bean
@ConditionalOnMissingBean({ TaskSchedulerBuilder.class, ThreadPoolTaskSchedulerBuilder.class }) @ConditionalOnMissingBean({ org.springframework.boot.task.TaskSchedulerBuilder.class,
ThreadPoolTaskSchedulerBuilder.class })
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder(TaskSchedulingProperties properties, ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder(TaskSchedulingProperties properties,
ObjectProvider<ThreadPoolTaskSchedulerCustomizer> threadPoolTaskSchedulerCustomizers, ObjectProvider<ThreadPoolTaskSchedulerCustomizer> threadPoolTaskSchedulerCustomizers,
ObjectProvider<TaskSchedulerCustomizer> taskSchedulerCustomizers) { ObjectProvider<org.springframework.boot.task.TaskSchedulerCustomizer> taskSchedulerCustomizers) {
TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown(); TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown();
ThreadPoolTaskSchedulerBuilder builder = new ThreadPoolTaskSchedulerBuilder(); ThreadPoolTaskSchedulerBuilder builder = new ThreadPoolTaskSchedulerBuilder();
builder = builder.poolSize(properties.getPool().getSize()); builder = builder.poolSize(properties.getPool().getSize());
@ -111,7 +110,8 @@ class TaskSchedulingConfigurations {
return builder; return builder;
} }
private ThreadPoolTaskSchedulerCustomizer adapt(TaskSchedulerCustomizer customizer) { private ThreadPoolTaskSchedulerCustomizer adapt(
org.springframework.boot.task.TaskSchedulerCustomizer customizer) {
return customizer::customize; return customizer::customize;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,13 +35,14 @@ import org.springframework.context.annotation.Scope;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.web.client.RestClient; import org.springframework.web.client.RestClient;
import org.springframework.web.client.RestClient.Builder;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for {@link RestClient}. * {@link EnableAutoConfiguration Auto-configuration} for {@link RestClient}.
* <p> * <p>
* This will produce a {@link RestClient.Builder RestClient.Builder} bean with the * This will produce a {@link Builder RestClient.Builder} bean with the {@code prototype}
* {@code prototype} scope, meaning each injection point will receive a newly cloned * scope, meaning each injection point will receive a newly cloned instance of the
* instance of the builder. * builder.
* *
* @author Arjen Poutsma * @author Arjen Poutsma
* @author Moritz Halbritter * @author Moritz Halbritter

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@ import org.springframework.web.client.RestClient;
import org.springframework.web.client.RestClient.Builder; import org.springframework.web.client.RestClient.Builder;
/** /**
* Configure {@link RestClient.Builder} with sensible defaults. * Configure {@link Builder RestClient.Builder} with sensible defaults.
* *
* @author Moritz Halbritter * @author Moritz Halbritter
* @since 3.2.0 * @since 3.2.0
@ -37,9 +37,9 @@ public class RestClientBuilderConfigurer {
} }
/** /**
* Configure the specified {@link RestClient.Builder}. The builder can be further * Configure the specified {@link Builder RestClient.Builder}. The builder can be
* tuned and default settings can be overridden. * further tuned and default settings can be overridden.
* @param builder the {@link RestClient.Builder} instance to configure * @param builder the {@link Builder RestClient.Builder} instance to configure
* @return the configured builder * @return the configured builder
*/ */
public RestClient.Builder configure(RestClient.Builder builder) { public RestClient.Builder configure(RestClient.Builder builder) {

View File

@ -27,7 +27,6 @@ import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLOutputType; import graphql.schema.GraphQLOutputType;
import graphql.schema.GraphQLSchema; import graphql.schema.GraphQLSchema;
import graphql.schema.idl.RuntimeWiring; import graphql.schema.idl.RuntimeWiring;
import graphql.schema.visibility.DefaultGraphqlFieldVisibility;
import org.assertj.core.api.InstanceOfAssertFactories; import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -171,20 +170,13 @@ class GraphQlAutoConfigurationTests {
@Test @Test
void fieldIntrospectionShouldBeEnabledByDefault() { void fieldIntrospectionShouldBeEnabledByDefault() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> assertThat(Introspection.isEnabledJvmWide()).isTrue());
GraphQlSource graphQlSource = context.getBean(GraphQlSource.class);
GraphQLSchema schema = graphQlSource.schema();
assertThat(schema.getCodeRegistry().getFieldVisibility()).isInstanceOf(DefaultGraphqlFieldVisibility.class);
});
} }
@Test @Test
void shouldDisableFieldIntrospection() { void shouldDisableFieldIntrospection() {
this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false").run((context) -> { this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false")
GraphQlSource graphQlSource = context.getBean(GraphQlSource.class); .run((context) -> assertThat(Introspection.isEnabledJvmWide()).isFalse());
GraphQLSchema schema = graphQlSource.schema();
assertThat(Introspection.isEnabledJvmWide()).isFalse();
});
} }
@Test @Test

View File

@ -80,6 +80,7 @@ class TaskExecutionAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void shouldNotSupplyThreadPoolTaskExecutorBuilderIfCustomTaskExecutorBuilderIsPresent() { void shouldNotSupplyThreadPoolTaskExecutorBuilderIfCustomTaskExecutorBuilderIsPresent() {
this.contextRunner.withBean(TaskExecutorBuilder.class, TaskExecutorBuilder::new).run((context) -> { this.contextRunner.withBean(TaskExecutorBuilder.class, TaskExecutorBuilder::new).run((context) -> {
assertThat(context).hasSingleBean(TaskExecutorBuilder.class); assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
@ -164,6 +165,7 @@ class TaskExecutionAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void taskExecutorBuilderShouldUseTaskDecorator() { void taskExecutorBuilderShouldUseTaskDecorator() {
this.contextRunner.withUserConfiguration(TaskDecoratorConfig.class).run((context) -> { this.contextRunner.withUserConfiguration(TaskDecoratorConfig.class).run((context) -> {
assertThat(context).hasSingleBean(TaskExecutorBuilder.class); assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
@ -275,6 +277,7 @@ class TaskExecutionAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void taskExecutorBuilderShouldApplyCustomizer() { void taskExecutorBuilderShouldApplyCustomizer() {
this.contextRunner.withUserConfiguration(TaskExecutorCustomizerConfig.class).run((context) -> { this.contextRunner.withUserConfiguration(TaskExecutorCustomizerConfig.class).run((context) -> {
TaskExecutorCustomizer customizer = context.getBean(TaskExecutorCustomizer.class); TaskExecutorCustomizer customizer = context.getBean(TaskExecutorCustomizer.class);
@ -284,6 +287,7 @@ class TaskExecutionAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void threadPoolTaskExecutorBuilderShouldApplyCustomizer() { void threadPoolTaskExecutorBuilderShouldApplyCustomizer() {
this.contextRunner.withUserConfiguration(TaskExecutorCustomizerConfig.class).run((context) -> { this.contextRunner.withUserConfiguration(TaskExecutorCustomizerConfig.class).run((context) -> {
TaskExecutorCustomizer customizer = context.getBean(TaskExecutorCustomizer.class); TaskExecutorCustomizer customizer = context.getBean(TaskExecutorCustomizer.class);
@ -335,6 +339,7 @@ class TaskExecutionAutoConfigurationTests {
}); });
} }
@SuppressWarnings("deprecation")
private ContextConsumer<AssertableApplicationContext> assertTaskExecutor( private ContextConsumer<AssertableApplicationContext> assertTaskExecutor(
Consumer<ThreadPoolTaskExecutor> taskExecutor) { Consumer<ThreadPoolTaskExecutor> taskExecutor) {
return (context) -> { return (context) -> {
@ -379,7 +384,8 @@ class TaskExecutionAutoConfigurationTests {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
static class CustomTaskExecutorBuilderConfig { static class CustomTaskExecutorBuilderConfig {
private final TaskExecutorBuilder taskExecutorBuilder = new TaskExecutorBuilder() @SuppressWarnings("deprecation")
private final org.springframework.boot.task.TaskExecutorBuilder taskExecutorBuilder = new org.springframework.boot.task.TaskExecutorBuilder()
.threadNamePrefix("CustomTaskExecutorBuilderConfig-"); .threadNamePrefix("CustomTaskExecutorBuilderConfig-");
@Bean @Bean

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -87,6 +87,7 @@ class TaskSchedulingAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void shouldNotSupplyThreadPoolTaskSchedulerBuilderIfCustomTaskSchedulerBuilderIsPresent() { void shouldNotSupplyThreadPoolTaskSchedulerBuilderIfCustomTaskSchedulerBuilderIsPresent() {
this.contextRunner.withUserConfiguration(SchedulingConfiguration.class) this.contextRunner.withUserConfiguration(SchedulingConfiguration.class)
.withBean(TaskSchedulerBuilder.class, TaskSchedulerBuilder::new) .withBean(TaskSchedulerBuilder.class, TaskSchedulerBuilder::new)
@ -155,7 +156,6 @@ class TaskSchedulingAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("unchecked")
void simpleAsyncTaskSchedulerBuilderShouldApplyCustomizers() { void simpleAsyncTaskSchedulerBuilderShouldApplyCustomizers() {
SimpleAsyncTaskSchedulerCustomizer customizer = (scheduler) -> { SimpleAsyncTaskSchedulerCustomizer customizer = (scheduler) -> {
}; };

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2023 the original author or authors. * Copyright 2023-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -37,6 +37,7 @@ public class MyBean {
this.pulsarReaderFactory = pulsarReaderFactory; this.pulsarReaderFactory = pulsarReaderFactory;
} }
@SuppressWarnings("unused")
public void someMethod() { public void someMethod() {
ReactiveMessageReaderBuilderCustomizer<String> readerBuilderCustomizer = (readerBuilder) -> readerBuilder ReactiveMessageReaderBuilderCustomizer<String> readerBuilderCustomizer = (readerBuilder) -> readerBuilder
.topic("someTopic") .topic("someTopic")

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2023 the original author or authors. * Copyright 2023-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,8 +16,6 @@
package org.springframework.boot.docs.messaging.pulsar.sending; package org.springframework.boot.docs.messaging.pulsar.sending;
import org.apache.pulsar.client.api.PulsarClientException;
import org.springframework.pulsar.core.PulsarTemplate; import org.springframework.pulsar.core.PulsarTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -30,7 +28,7 @@ public class MyBean {
this.pulsarTemplate = pulsarTemplate; this.pulsarTemplate = pulsarTemplate;
} }
public void someMethod() throws PulsarClientException { public void someMethod() {
this.pulsarTemplate.send("someTopic", "Hello"); this.pulsarTemplate.send("someTopic", "Hello");
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,13 +29,13 @@ import org.springframework.boot.test.web.client.MockServerRestClientCustomizer;
import org.springframework.boot.test.web.client.MockServerRestTemplateCustomizer; import org.springframework.boot.test.web.client.MockServerRestTemplateCustomizer;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestClient; import org.springframework.web.client.RestClient.Builder;
/** /**
* Annotation that can be applied to a test class to enable and configure * Annotation that can be applied to a test class to enable and configure
* auto-configuration of a single {@link MockRestServiceServer}. Only useful when a single * auto-configuration of a single {@link MockRestServiceServer}. Only useful when a single
* call is made to {@link RestTemplateBuilder} or {@link RestClient.Builder}. If multiple * call is made to {@link RestTemplateBuilder} or {@link Builder RestClient.Builder}. If
* {@link org.springframework.web.client.RestTemplate RestTemplates} or * multiple {@link org.springframework.web.client.RestTemplate RestTemplates} or
* {@link org.springframework.web.client.RestClient RestClients} are in use, inject a * {@link org.springframework.web.client.RestClient RestClients} are in use, inject a
* {@link MockServerRestTemplateCustomizer} and use * {@link MockServerRestTemplateCustomizer} and use
* {@link MockServerRestTemplateCustomizer#getServer(org.springframework.web.client.RestTemplate) * {@link MockServerRestTemplateCustomizer#getServer(org.springframework.web.client.RestTemplate)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,12 +38,12 @@ import org.springframework.stereotype.Component;
import org.springframework.test.context.BootstrapWith; import org.springframework.test.context.BootstrapWith;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestClient; import org.springframework.web.client.RestClient.Builder;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
/** /**
* Annotation for a Spring rest client test that focuses <strong>only</strong> on beans * Annotation for a Spring rest client test that focuses <strong>only</strong> on beans
* that use {@link RestTemplateBuilder} or {@link RestClient.Builder}. * that use {@link RestTemplateBuilder} or {@link Builder RestClient.Builder}.
* <p> * <p>
* Using this annotation will disable full auto-configuration and instead apply only * Using this annotation will disable full auto-configuration and instead apply only
* configuration relevant to rest client tests (i.e. Jackson or GSON auto-configuration * configuration relevant to rest client tests (i.e. Jackson or GSON auto-configuration

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class ConditionReportApplicationContextFailureProcessorTests { class ConditionReportApplicationContextFailureProcessorTests {
@Test @Test
void loadFailureShouldPrintReport(CapturedOutput output) throws Exception { void loadFailureShouldPrintReport(CapturedOutput output) {
SpringApplication application = new SpringApplication(TestConfig.class); SpringApplication application = new SpringApplication(TestConfig.class);
application.setWebApplicationType(WebApplicationType.NONE); application.setWebApplicationType(WebApplicationType.NONE);
ConfigurableApplicationContext applicationContext = application.run(); ConfigurableApplicationContext applicationContext = application.run();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,7 +20,6 @@ import java.util.Collections;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericApplicationContext; import org.springframework.context.support.GenericApplicationContext;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
@ -148,11 +147,6 @@ class ObservabilityContextCustomizerFactoryTests {
return contextCustomizer; return contextCustomizer;
} }
private ApplicationContextInitializer<ConfigurableApplicationContext> applyCustomizer(
ContextCustomizer customizer) {
return (applicationContext) -> customizer.customizeContext(applicationContext, null);
}
private void assertThatTracingIsDisabled(ConfigurableApplicationContext context) { private void assertThatTracingIsDisabled(ConfigurableApplicationContext context) {
assertThat(context.getEnvironment().getProperty("management.tracing.enabled")).isEqualTo("false"); assertThat(context.getEnvironment().getProperty("management.tracing.enabled")).isEqualTo("false");
} }

View File

@ -30,9 +30,10 @@ import org.springframework.test.web.client.RequestExpectationManager;
import org.springframework.test.web.client.SimpleRequestExpectationManager; import org.springframework.test.web.client.SimpleRequestExpectationManager;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.client.RestClient; import org.springframework.web.client.RestClient;
import org.springframework.web.client.RestClient.Builder;
/** /**
* {@link RestClientCustomizer} that can be applied to {@link RestClient.Builder} * {@link RestClientCustomizer} that can be applied to {@link Builder RestClient.Builder}
* instances to add {@link MockRestServiceServer} support. * instances to add {@link MockRestServiceServer} support.
* <p> * <p>
* Typically applied to an existing builder before it is used, for example: * Typically applied to an existing builder before it is used, for example:

View File

@ -20,7 +20,6 @@ import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.pulsar.client.api.PulsarClientException;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.testcontainers.containers.PulsarContainer; import org.testcontainers.containers.PulsarContainer;
@ -63,7 +62,7 @@ class PulsarContainerConnectionDetailsFactoryIntegrationTests {
private TestListener listener; private TestListener listener;
@Test @Test
void connectionCanBeMadeToPulsarContainer() throws PulsarClientException { void connectionCanBeMadeToPulsarContainer() {
this.pulsarTemplate.send("test-topic", "test-data"); this.pulsarTemplate.send("test-topic", "test-data");
Awaitility.waitAtMost(Duration.ofSeconds(30)) Awaitility.waitAtMost(Duration.ofSeconds(30))
.untilAsserted(() -> assertThat(this.listener.messages).containsExactly("test-data")); .untilAsserted(() -> assertThat(this.listener.messages).containsExactly("test-data"));

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,10 +18,6 @@ package org.springframework.boot.configurationsample.record;
import org.springframework.boot.configurationsample.ConfigurationProperties; import org.springframework.boot.configurationsample.ConfigurationProperties;
/**
* @author Moritz Halbritter
* @param alpha the alpha property
*/
@ConfigurationProperties("record-with-getter") @ConfigurationProperties("record-with-getter")
public record RecordWithGetter(String alpha) { public record RecordWithGetter(String alpha) {

View File

@ -32,7 +32,6 @@ public final class GradleVersions {
private GradleVersions() { private GradleVersions() {
} }
@SuppressWarnings("UnstableApiUsage")
public static List<String> allCompatible() { public static List<String> allCompatible() {
if (isJavaVersion(JavaVersion.VERSION_20)) { if (isJavaVersion(JavaVersion.VERSION_20)) {
return Arrays.asList("8.1.1", "8.9"); return Arrays.asList("8.1.1", "8.9");

View File

@ -268,6 +268,12 @@ public abstract class Packager {
} }
} }
/**
* Writes a signature file if necessary for the given {@code writtenLibraries}.
* @param writtenLibraries the libraries
* @param writer the writer to use to write the signature file if necessary
* @throws IOException if a failure occurs when writing the signature file
*/
protected void writeSignatureFileIfNecessary(Map<String, Library> writtenLibraries, AbstractJarWriter writer) protected void writeSignatureFileIfNecessary(Map<String, Library> writtenLibraries, AbstractJarWriter writer)
throws IOException { throws IOException {
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,44 +33,49 @@ class ByteArrayDataBlockTests {
@Test @Test
void sizeReturnsByteArrayLength() throws Exception { void sizeReturnsByteArrayLength() throws Exception {
ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES); try (ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES)) {
assertThat(dataBlock.size()).isEqualTo(this.BYTES.length); assertThat(dataBlock.size()).isEqualTo(this.BYTES.length);
}
} }
@Test @Test
void readPutsBytes() throws Exception { void readPutsBytes() throws Exception {
ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES); try (ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES)) {
ByteBuffer dst = ByteBuffer.allocate(8); ByteBuffer dst = ByteBuffer.allocate(8);
int result = dataBlock.read(dst, 0); int result = dataBlock.read(dst, 0);
assertThat(result).isEqualTo(8); assertThat(result).isEqualTo(8);
assertThat(dst.array()).containsExactly(this.BYTES); assertThat(dst.array()).containsExactly(this.BYTES);
}
} }
@Test @Test
void readWhenLessBytesThanRemainingInBufferPutsBytes() throws Exception { void readWhenLessBytesThanRemainingInBufferPutsBytes() throws Exception {
ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES); try (ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES)) {
ByteBuffer dst = ByteBuffer.allocate(9); ByteBuffer dst = ByteBuffer.allocate(9);
int result = dataBlock.read(dst, 0); int result = dataBlock.read(dst, 0);
assertThat(result).isEqualTo(8); assertThat(result).isEqualTo(8);
assertThat(dst.array()).containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 0); assertThat(dst.array()).containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 0);
}
} }
@Test @Test
void readWhenLessRemainingInBufferThanLengthPutsBytes() throws Exception { void readWhenLessRemainingInBufferThanLengthPutsBytes() throws Exception {
ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES); try (ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES)) {
ByteBuffer dst = ByteBuffer.allocate(7); ByteBuffer dst = ByteBuffer.allocate(7);
int result = dataBlock.read(dst, 0); int result = dataBlock.read(dst, 0);
assertThat(result).isEqualTo(7); assertThat(result).isEqualTo(7);
assertThat(dst.array()).containsExactly(0, 1, 2, 3, 4, 5, 6); assertThat(dst.array()).containsExactly(0, 1, 2, 3, 4, 5, 6);
}
} }
@Test @Test
void readWhenHasPosOffsetReadsBytes() throws Exception { void readWhenHasPosOffsetReadsBytes() throws Exception {
ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES); try (ByteArrayDataBlock dataBlock = new ByteArrayDataBlock(this.BYTES)) {
ByteBuffer dst = ByteBuffer.allocate(3); ByteBuffer dst = ByteBuffer.allocate(3);
int result = dataBlock.read(dst, 4); int result = dataBlock.read(dst, 4);
assertThat(result).isEqualTo(3); assertThat(result).isEqualTo(3);
assertThat(dst.array()).containsExactly(4, 5, 6); assertThat(dst.array()).containsExactly(4, 5, 6);
}
} }
} }

View File

@ -83,8 +83,6 @@ import org.springframework.util.StringUtils;
*/ */
public class Log4J2LoggingSystem extends AbstractLoggingSystem { public class Log4J2LoggingSystem extends AbstractLoggingSystem {
private static final String FILE_PROTOCOL = "file";
private static final String LOG4J_BRIDGE_HANDLER = "org.apache.logging.log4j.jul.Log4jBridgeHandler"; private static final String LOG4J_BRIDGE_HANDLER = "org.apache.logging.log4j.jul.Log4jBridgeHandler";
private static final String LOG4J_LOG_MANAGER = "org.apache.logging.log4j.jul.LogManager"; private static final String LOG4J_LOG_MANAGER = "org.apache.logging.log4j.jul.LogManager";

View File

@ -51,7 +51,6 @@ import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.JdkClientHttpRequestFactory; import org.springframework.http.client.JdkClientHttpRequestFactory;
import org.springframework.http.client.JettyClientHttpRequestFactory; import org.springframework.http.client.JettyClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
@ -90,7 +89,8 @@ public final class ClientHttpRequestFactories {
* <ol> * <ol>
* <li>{@link HttpComponentsClientHttpRequestFactory}</li> * <li>{@link HttpComponentsClientHttpRequestFactory}</li>
* <li>{@link JettyClientHttpRequestFactory}</li> * <li>{@link JettyClientHttpRequestFactory}</li>
* <li>{@link OkHttp3ClientHttpRequestFactory} (deprecated)</li> * <li>{@link org.springframework.http.client.OkHttp3ClientHttpRequestFactory
* OkHttp3ClientHttpRequestFactory} (deprecated)</li>
* <li>{@link SimpleClientHttpRequestFactory}</li> * <li>{@link SimpleClientHttpRequestFactory}</li>
* </ol> * </ol>
* @param settings the settings to apply * @param settings the settings to apply
@ -120,7 +120,8 @@ public final class ClientHttpRequestFactories {
* <li>{@link HttpComponentsClientHttpRequestFactory}</li> * <li>{@link HttpComponentsClientHttpRequestFactory}</li>
* <li>{@link JdkClientHttpRequestFactory}</li> * <li>{@link JdkClientHttpRequestFactory}</li>
* <li>{@link JettyClientHttpRequestFactory}</li> * <li>{@link JettyClientHttpRequestFactory}</li>
* <li>{@link OkHttp3ClientHttpRequestFactory} (deprecated)</li> * <li>{@link org.springframework.http.client.OkHttp3ClientHttpRequestFactory
* OkHttp3ClientHttpRequestFactory} (deprecated)</li>
* <li>{@link SimpleClientHttpRequestFactory}</li> * <li>{@link SimpleClientHttpRequestFactory}</li>
* </ul> * </ul>
* A {@code requestFactoryType} of {@link ClientHttpRequestFactory} is equivalent to * A {@code requestFactoryType} of {@link ClientHttpRequestFactory} is equivalent to
@ -149,7 +150,7 @@ public final class ClientHttpRequestFactories {
if (requestFactoryType == SimpleClientHttpRequestFactory.class) { if (requestFactoryType == SimpleClientHttpRequestFactory.class) {
return (T) Simple.get(settings); return (T) Simple.get(settings);
} }
if (requestFactoryType == OkHttp3ClientHttpRequestFactory.class) { if (requestFactoryType == org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class) {
return (T) OkHttp.get(settings); return (T) OkHttp.get(settings);
} }
return get(() -> createRequestFactory(requestFactoryType), settings); return get(() -> createRequestFactory(requestFactoryType), settings);
@ -220,21 +221,25 @@ public final class ClientHttpRequestFactories {
} }
/** /**
* Support for {@link OkHttp3ClientHttpRequestFactory}. * Support for
* {@link org.springframework.http.client.OkHttp3ClientHttpRequestFactory}.
*/ */
@Deprecated(since = "3.2.0", forRemoval = true) @Deprecated(since = "3.2.0", forRemoval = true)
@SuppressWarnings("removal") @SuppressWarnings("removal")
static class OkHttp { static class OkHttp {
static OkHttp3ClientHttpRequestFactory get(ClientHttpRequestFactorySettings settings) { static org.springframework.http.client.OkHttp3ClientHttpRequestFactory get(
OkHttp3ClientHttpRequestFactory requestFactory = createRequestFactory(settings.sslBundle()); ClientHttpRequestFactorySettings settings) {
org.springframework.http.client.OkHttp3ClientHttpRequestFactory requestFactory = createRequestFactory(
settings.sslBundle());
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(settings::connectTimeout).asInt(Duration::toMillis).to(requestFactory::setConnectTimeout); map.from(settings::connectTimeout).asInt(Duration::toMillis).to(requestFactory::setConnectTimeout);
map.from(settings::readTimeout).asInt(Duration::toMillis).to(requestFactory::setReadTimeout); map.from(settings::readTimeout).asInt(Duration::toMillis).to(requestFactory::setReadTimeout);
return requestFactory; return requestFactory;
} }
private static OkHttp3ClientHttpRequestFactory createRequestFactory(SslBundle sslBundle) { private static org.springframework.http.client.OkHttp3ClientHttpRequestFactory createRequestFactory(
SslBundle sslBundle) {
if (sslBundle != null) { if (sslBundle != null) {
Assert.state(!sslBundle.getOptions().isSpecified(), "SSL Options cannot be specified with OkHttp"); Assert.state(!sslBundle.getOptions().isSpecified(), "SSL Options cannot be specified with OkHttp");
SSLSocketFactory socketFactory = sslBundle.createSslContext().getSocketFactory(); SSLSocketFactory socketFactory = sslBundle.createSslContext().getSocketFactory();
@ -244,9 +249,9 @@ public final class ClientHttpRequestFactories {
OkHttpClient client = new OkHttpClient.Builder() OkHttpClient client = new OkHttpClient.Builder()
.sslSocketFactory(socketFactory, (X509TrustManager) trustManagers[0]) .sslSocketFactory(socketFactory, (X509TrustManager) trustManagers[0])
.build(); .build();
return new OkHttp3ClientHttpRequestFactory(client); return new org.springframework.http.client.OkHttp3ClientHttpRequestFactory(client);
} }
return new OkHttp3ClientHttpRequestFactory(); return new org.springframework.http.client.OkHttp3ClientHttpRequestFactory();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,6 @@ import org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper;
import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.JettyClientHttpRequestFactory; import org.springframework.http.client.JettyClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
@ -72,7 +71,7 @@ class ClientHttpRequestFactoriesRuntimeHints implements RuntimeHintsRegistrar {
private void registerOkHttpHints(ReflectionHints hints, ClassLoader classLoader) { private void registerOkHttpHints(ReflectionHints hints, ClassLoader classLoader) {
hints.registerTypeIfPresent(classLoader, ClientHttpRequestFactories.OKHTTP_CLIENT_CLASS, (typeHint) -> { hints.registerTypeIfPresent(classLoader, ClientHttpRequestFactories.OKHTTP_CLIENT_CLASS, (typeHint) -> {
typeHint.onReachableType(TypeReference.of(ClientHttpRequestFactories.OKHTTP_CLIENT_CLASS)); typeHint.onReachableType(TypeReference.of(ClientHttpRequestFactories.OKHTTP_CLIENT_CLASS));
registerReflectionHints(hints, OkHttp3ClientHttpRequestFactory.class); registerReflectionHints(hints, org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class);
}); });
} }

View File

@ -284,7 +284,6 @@ class StandardConfigDataLocationResolverTests {
void resolveWhenOptionalAndLoaderIsUnknownAndExtensionIsUnknownShouldNotFail() { void resolveWhenOptionalAndLoaderIsUnknownAndExtensionIsUnknownShouldNotFail() {
ConfigDataLocation location = ConfigDataLocation ConfigDataLocation location = ConfigDataLocation
.of("optional:some-unknown-loader:dummy.some-unknown-extension"); .of("optional:some-unknown-loader:dummy.some-unknown-extension");
List<StandardConfigDataResource> locations = this.resolver.resolve(this.context, location);
assertThatNoException().isThrownBy(() -> this.resolver.resolve(this.context, location)); assertThatNoException().isThrownBy(() -> this.resolver.resolve(this.context, location));
} }

View File

@ -227,6 +227,7 @@ class ConfigurationPropertiesBeanRegistrationAotProcessorTests {
this.counter = counter; this.counter = counter;
} }
@SuppressWarnings("unused")
private ValueObjectWithSpecificConstructorSampleBean(String name) { private ValueObjectWithSpecificConstructorSampleBean(String name) {
this(name, 42); this(name, 42);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -37,7 +37,7 @@ import static org.mockito.Mockito.spy;
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Filip Hrisafov * @author Filip Hrisafov
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class TaskExecutorBuilderTests { class TaskExecutorBuilderTests {
private final TaskExecutorBuilder builder = new TaskExecutorBuilder(); private final TaskExecutorBuilder builder = new TaskExecutorBuilder();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,7 +35,7 @@ import static org.mockito.Mockito.spy;
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
@SuppressWarnings("removal") @SuppressWarnings({ "deprecation", "removal" })
class TaskSchedulerBuilderTests { class TaskSchedulerBuilderTests {
private final TaskSchedulerBuilder builder = new TaskSchedulerBuilder(); private final TaskSchedulerBuilder builder = new TaskSchedulerBuilder();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,6 @@ import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper; import org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.JettyClientHttpRequestFactory; import org.springframework.http.client.JettyClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
@ -69,11 +68,15 @@ class ClientHttpRequestFactoriesRuntimeHintsTests {
RuntimeHints hints = new RuntimeHints(); RuntimeHints hints = new RuntimeHints();
new ClientHttpRequestFactoriesRuntimeHints().registerHints(hints, getClass().getClassLoader()); new ClientHttpRequestFactoriesRuntimeHints().registerHints(hints, getClass().getClassLoader());
ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection(); ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection();
assertThat(reflection.onMethod(method(OkHttp3ClientHttpRequestFactory.class, "setConnectTimeout", int.class))) assertThat(reflection.onMethod(method(org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class,
"setConnectTimeout", int.class)))
.accepts(hints); .accepts(hints);
assertThat(reflection.onMethod(method(OkHttp3ClientHttpRequestFactory.class, "setReadTimeout", int.class))) assertThat(reflection.onMethod(method(org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class,
"setReadTimeout", int.class)))
.accepts(hints); .accepts(hints);
assertThat(hints.reflection().getTypeHint(OkHttp3ClientHttpRequestFactory.class).methods()).hasSize(2); assertThat(hints.reflection()
.getTypeHint(org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class)
.methods()).hasSize(2);
} }
@Test @Test

View File

@ -27,7 +27,6 @@ import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.JdkClientHttpRequestFactory; import org.springframework.http.client.JdkClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -72,9 +71,10 @@ class ClientHttpRequestFactoriesTests {
@Deprecated(since = "3.2.0") @Deprecated(since = "3.2.0")
@SuppressWarnings("removal") @SuppressWarnings("removal")
void getOfOkHttpFactoryReturnsOkHttpFactory() { void getOfOkHttpFactoryReturnsOkHttpFactory() {
ClientHttpRequestFactory requestFactory = ClientHttpRequestFactories.get(OkHttp3ClientHttpRequestFactory.class, ClientHttpRequestFactory requestFactory = ClientHttpRequestFactories.get(
org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class,
ClientHttpRequestFactorySettings.DEFAULTS); ClientHttpRequestFactorySettings.DEFAULTS);
assertThat(requestFactory).isInstanceOf(OkHttp3ClientHttpRequestFactory.class); assertThat(requestFactory).isInstanceOf(org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class);
} }
@Test @Test

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,7 +18,6 @@ package smoketest.actuator;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.boot.test.web.server.LocalManagementPort;
@ -30,8 +29,8 @@ import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Integration tests for separate management and main service ports with Actuator's MVC * Integration tests for separate management and main service ports with Actuator's MVC
* {@link RestControllerEndpoint rest controller endpoints} and {@link ExceptionHandler * {@link org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint
* exception handler}. * rest controller endpoints} and {@link ExceptionHandler exception handler}.
* *
* @author Guirong Hu * @author Guirong Hu
*/ */