mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Replace anonymous class with lambdas
See gh-17040
This commit is contained in:
parent
0fcc561163
commit
46677e30cf
@ -538,25 +538,20 @@ public class TomcatServletWebServerFactoryTests
|
||||
throws IOException, URISyntaxException {
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
|
||||
AtomicReference<ServletContext> servletContextReference = new AtomicReference<>();
|
||||
factory.addInitializers(new ServletContextInitializer() {
|
||||
factory.addInitializers((ServletContextInitializer) servletContext -> {
|
||||
servletContextReference.set(servletContext);
|
||||
Dynamic servlet = servletContext.addServlet("upload", new HttpServlet() {
|
||||
|
||||
@Override
|
||||
public void onStartup(ServletContext servletContext) throws ServletException {
|
||||
servletContextReference.set(servletContext);
|
||||
Dynamic servlet = servletContext.addServlet("upload", new HttpServlet() {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req,
|
||||
HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
req.getParts();
|
||||
}
|
||||
|
||||
});
|
||||
servlet.addMapping("/upload");
|
||||
servlet.setMultipartConfig(new MultipartConfigElement((String) null));
|
||||
}
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req,
|
||||
HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
req.getParts();
|
||||
}
|
||||
|
||||
});
|
||||
servlet.addMapping("/upload");
|
||||
servlet.setMultipartConfig(new MultipartConfigElement((String) null));
|
||||
});
|
||||
this.webServer = factory.getWebServer();
|
||||
this.webServer.start();
|
||||
|
@ -503,16 +503,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||
new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
||||
.loadKeyMaterial(keyStore, "secret".toCharArray(),
|
||||
new PrivateKeyStrategy() {
|
||||
|
||||
@Override
|
||||
public String chooseAlias(
|
||||
Map<String, PrivateKeyDetails> aliases,
|
||||
Socket socket) {
|
||||
return "spring-boot";
|
||||
}
|
||||
|
||||
})
|
||||
(aliases, socket) -> "spring-boot")
|
||||
.build());
|
||||
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
||||
.build();
|
||||
@ -538,15 +529,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||
new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
||||
.loadKeyMaterial(keyStore, "password".toCharArray(),
|
||||
new PrivateKeyStrategy() {
|
||||
|
||||
@Override
|
||||
public String chooseAlias(
|
||||
Map<String, PrivateKeyDetails> aliases,
|
||||
Socket socket) {
|
||||
return "spring-boot";
|
||||
}
|
||||
})
|
||||
(aliases, socket) -> "spring-boot")
|
||||
.build());
|
||||
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
||||
.build();
|
||||
@ -639,15 +622,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||
new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
||||
.loadKeyMaterial(keyStore, "password".toCharArray(),
|
||||
new PrivateKeyStrategy() {
|
||||
|
||||
@Override
|
||||
public String chooseAlias(
|
||||
Map<String, PrivateKeyDetails> aliases,
|
||||
Socket socket) {
|
||||
return "spring-boot";
|
||||
}
|
||||
})
|
||||
(aliases, socket) -> "spring-boot")
|
||||
.build());
|
||||
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
||||
.build();
|
||||
|
Loading…
Reference in New Issue
Block a user