Skip to content

Commit b81d590

Browse files
committed
Use newer language features
See gh-33987
2 parents c7a8151 + a895847 commit b81d590

File tree

4 files changed

+8
-30
lines changed

4 files changed

+8
-30
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -88,7 +88,7 @@ public WebFluxEndpointHandlerMapping webEndpointReactiveHandlerMapping(WebEndpoi
8888
private boolean shouldRegisterLinksMapping(WebEndpointProperties properties, Environment environment,
8989
String basePath) {
9090
return properties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath)
91-
|| ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
91+
|| ManagementPortType.get(environment) == ManagementPortType.DIFFERENT);
9292
}
9393

9494
@Bean

spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithJdkProxyTests.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.boot.test.mock.mockito;
1818

19-
import java.lang.reflect.InvocationHandler;
20-
import java.lang.reflect.Method;
2119
import java.lang.reflect.Proxy;
2220

2321
import org.junit.jupiter.api.Test;
@@ -60,14 +58,7 @@ static class Config {
6058
@Bean
6159
ExampleRepository dateService() {
6260
return (ExampleRepository) Proxy.newProxyInstance(getClass().getClassLoader(),
63-
new Class<?>[] { ExampleRepository.class }, new InvocationHandler() {
64-
65-
@Override
66-
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
67-
return new Example((String) args[0]);
68-
}
69-
70-
});
61+
new Class<?>[] { ExampleRepository.class }, (proxy, method, args) -> new Example((String) args[0]));
7162
}
7263

7364
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-flyway/src/main/java/smoketest/flyway/SampleFlywayApplication.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,14 +30,7 @@ public static void main(String[] args) {
3030

3131
@Bean
3232
public CommandLineRunner runner(PersonRepository repository) {
33-
return new CommandLineRunner() {
34-
35-
@Override
36-
public void run(String... args) throws Exception {
37-
System.err.println(repository.findAll());
38-
}
39-
40-
};
33+
return (args) -> System.err.println(repository.findAll());
4134
}
4235

4336
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/AbstractJerseyManagementPortTests.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
import javax.ws.rs.GET;
2020
import javax.ws.rs.Path;
2121

22-
import org.glassfish.jersey.server.ResourceConfig;
2322
import org.junit.jupiter.api.Test;
2423
import smoketest.jersey.AbstractJerseyManagementPortTests.ResourceConfigConfiguration;
2524

@@ -90,12 +89,7 @@ static class ResourceConfigConfiguration {
9089

9190
@Bean
9291
ResourceConfigCustomizer customizer() {
93-
return new ResourceConfigCustomizer() {
94-
@Override
95-
public void customize(ResourceConfig config) {
96-
config.register(TestEndpoint.class);
97-
}
98-
};
92+
return (config) -> config.register(TestEndpoint.class);
9993
}
10094

10195
@Path("/test")

0 commit comments

Comments
 (0)