Add nullability annotations to smoke-test/spring-boot-smoke-test-actuator-extension

See gh-46587
This commit is contained in:
Moritz Halbritter 2025-08-12 09:30:08 +02:00
parent e1f4102dfb
commit 8e17277efd
3 changed files with 25 additions and 2 deletions

View File

@ -18,6 +18,8 @@ package smoketest.actuator.extension;
import java.util.Set; import java.util.Set;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.EndpointExposureOutcomeContributor; import org.springframework.boot.actuate.autoconfigure.endpoint.condition.EndpointExposureOutcomeContributor;
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.EndpointExposure; import org.springframework.boot.actuate.autoconfigure.endpoint.expose.EndpointExposure;
import org.springframework.boot.actuate.endpoint.EndpointId; import org.springframework.boot.actuate.endpoint.EndpointId;
@ -34,7 +36,7 @@ class MyExtensionEndpointExposureOutcomeContributor implements EndpointExposureO
} }
@Override @Override
public ConditionOutcome getExposureOutcome(EndpointId endpointId, Set<EndpointExposure> exposures, public @Nullable ConditionOutcome getExposureOutcome(EndpointId endpointId, Set<EndpointExposure> exposures,
Builder message) { Builder message) {
if (exposures.contains(EndpointExposure.WEB) && this.filter.match(endpointId)) { if (exposures.contains(EndpointExposure.WEB) && this.filter.match(endpointId)) {
return ConditionOutcome.match(message.because("marked as exposed by a my extension '" return ConditionOutcome.match(message.because("marked as exposed by a my extension '"

View File

@ -23,6 +23,7 @@ import java.util.Map;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.jspecify.annotations.Nullable;
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;
@ -40,7 +41,7 @@ class MyExtensionWebMvcEndpointHandlerMapping extends AbstractWebMvcEndpointHand
private final EndpointLinksResolver linksResolver; private final EndpointLinksResolver linksResolver;
MyExtensionWebMvcEndpointHandlerMapping(Collection<ExposableWebEndpoint> endpoints, MyExtensionWebMvcEndpointHandlerMapping(Collection<ExposableWebEndpoint> endpoints,
EndpointMediaTypes endpointMediaTypes, CorsConfiguration corsConfiguration) { EndpointMediaTypes endpointMediaTypes, @Nullable CorsConfiguration corsConfiguration) {
super(new EndpointMapping(PATH), endpoints, endpointMediaTypes, corsConfiguration, true); super(new EndpointMapping(PATH), endpoints, endpointMediaTypes, corsConfiguration, true);
this.linksResolver = new EndpointLinksResolver(endpoints, PATH); this.linksResolver = new EndpointLinksResolver(endpoints, PATH);
setOrder(-100); setOrder(-100);

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@NullMarked
package smoketest.actuator.extension;
import org.jspecify.annotations.NullMarked;