mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Polish
See gh-32840
This commit is contained in:
parent
b76259457e
commit
5067aab552
@ -108,7 +108,7 @@ public class BomExtension {
|
||||
}
|
||||
|
||||
public void library(String name, Action<LibraryHandler> action) {
|
||||
this.library(name, null, action);
|
||||
library(name, null, action);
|
||||
}
|
||||
|
||||
public void library(String name, String version, Action<LibraryHandler> action) {
|
||||
|
@ -57,7 +57,7 @@ class ReactiveCloudFoundrySecurityService {
|
||||
|
||||
ReactiveCloudFoundrySecurityService(WebClient.Builder webClientBuilder, String cloudControllerUrl,
|
||||
boolean skipSslValidation) {
|
||||
Assert.notNull(webClientBuilder, "Webclient must not be null");
|
||||
Assert.notNull(webClientBuilder, "WebClient must not be null");
|
||||
Assert.notNull(cloudControllerUrl, "CloudControllerUrl must not be null");
|
||||
if (skipSslValidation) {
|
||||
webClientBuilder.clientConnector(buildTrustAllSslConnector());
|
||||
|
@ -55,7 +55,7 @@ public class ExemplarsAutoConfiguration {
|
||||
/**
|
||||
* Since the MeterRegistry can depend on the {@link Tracer} (Exemplars) and the
|
||||
* {@link Tracer} can depend on the MeterRegistry (recording metrics), this
|
||||
* {@link SpanContextSupplier} breaks the circle by lazily loading the {@link Tracer}.
|
||||
* {@link SpanContextSupplier} breaks the cycle by lazily loading the {@link Tracer}.
|
||||
*/
|
||||
static class LazyTracingSpanContextSupplier implements SpanContextSupplier {
|
||||
|
||||
|
@ -93,7 +93,7 @@ class ZipkinConfigurationsSenderConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void willUseRestTemplateInNonWebApplicationIfUrlConnectionSenderAndWebclientAreNotAvailable() {
|
||||
void willUseRestTemplateInNonWebApplicationIfUrlConnectionSenderAndWebClientAreNotAvailable() {
|
||||
this.contextRunner.withUserConfiguration(RestTemplateConfiguration.class)
|
||||
.withClassLoader(new FilteredClassLoader(URLConnectionSender.class, WebClient.class)).run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(URLConnectionSender.class);
|
||||
|
@ -467,7 +467,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link SimpleModule} for configure the serializer.
|
||||
* {@link SimpleModule} for configuring the serializer.
|
||||
*/
|
||||
private static final class ConfigurationPropertiesModule extends SimpleModule {
|
||||
|
||||
|
@ -1270,12 +1270,12 @@ public class KafkaProperties {
|
||||
|
||||
private void validate() {
|
||||
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
|
||||
entries.put("spring.kafka.ssl.key-store-key", this.getKeyStoreKey());
|
||||
entries.put("spring.kafka.ssl.key-store-location", this.getKeyStoreLocation());
|
||||
entries.put("spring.kafka.ssl.key-store-key", getKeyStoreKey());
|
||||
entries.put("spring.kafka.ssl.key-store-location", getKeyStoreLocation());
|
||||
});
|
||||
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
|
||||
entries.put("spring.kafka.ssl.trust-store-certificates", this.getTrustStoreCertificates());
|
||||
entries.put("spring.kafka.ssl.trust-store-location", this.getTrustStoreLocation());
|
||||
entries.put("spring.kafka.ssl.trust-store-certificates", getTrustStoreCertificates());
|
||||
entries.put("spring.kafka.ssl.trust-store-location", getTrustStoreLocation());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -84,11 +84,11 @@ class CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests {
|
||||
|
||||
@Override
|
||||
protected void containerIsCreated(String containerId) {
|
||||
String config = this.copyFileFromContainer("/etc/cassandra/cassandra.yaml",
|
||||
String config = copyFileFromContainer("/etc/cassandra/cassandra.yaml",
|
||||
(stream) -> StreamUtils.copyToString(stream, StandardCharsets.UTF_8));
|
||||
String updatedConfig = config.replace("authenticator: AllowAllAuthenticator",
|
||||
"authenticator: PasswordAuthenticator");
|
||||
this.copyFileToContainer(Transferable.of(updatedConfig.getBytes(StandardCharsets.UTF_8)),
|
||||
copyFileToContainer(Transferable.of(updatedConfig.getBytes(StandardCharsets.UTF_8)),
|
||||
"/etc/cassandra/cassandra.yaml");
|
||||
}
|
||||
|
||||
|
@ -638,9 +638,9 @@ class WebFluxAutoConfigurationTests {
|
||||
@Test
|
||||
void problemDetailsBacksOffWhenExceptionHandler() {
|
||||
this.contextRunner.withPropertyValues("spring.webflux.problemdetails.enabled:true")
|
||||
.withUserConfiguration(CustomExceptionResolverConfiguration.class)
|
||||
.withUserConfiguration(CustomExceptionHandlerConfiguration.class)
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(ProblemDetailsExceptionHandler.class)
|
||||
.hasSingleBean(CustomExceptionResolver.class));
|
||||
.hasSingleBean(CustomExceptionHandler.class));
|
||||
}
|
||||
|
||||
private ContextConsumer<ReactiveWebApplicationContext> assertExchangeWithSession(
|
||||
@ -933,17 +933,17 @@ class WebFluxAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class CustomExceptionResolverConfiguration {
|
||||
static class CustomExceptionHandlerConfiguration {
|
||||
|
||||
@Bean
|
||||
CustomExceptionResolver customExceptionResolver() {
|
||||
return new CustomExceptionResolver();
|
||||
CustomExceptionHandler customExceptionHandler() {
|
||||
return new CustomExceptionHandler();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ControllerAdvice
|
||||
static class CustomExceptionResolver extends ResponseEntityExceptionHandler {
|
||||
static class CustomExceptionHandler extends ResponseEntityExceptionHandler {
|
||||
|
||||
}
|
||||
|
||||
|
@ -975,9 +975,9 @@ class WebMvcAutoConfigurationTests {
|
||||
@Test
|
||||
void problemDetailsBacksOffWhenExceptionHandler() {
|
||||
this.contextRunner.withPropertyValues("spring.mvc.problemdetails.enabled:true")
|
||||
.withUserConfiguration(CustomExceptionResolverConfiguration.class)
|
||||
.withUserConfiguration(CustomExceptionHandlerConfiguration.class)
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(ProblemDetailsExceptionHandler.class)
|
||||
.hasSingleBean(CustomExceptionResolver.class));
|
||||
.hasSingleBean(CustomExceptionHandler.class));
|
||||
}
|
||||
|
||||
private void assertResourceHttpRequestHandler(AssertableWebApplicationContext context,
|
||||
@ -1507,17 +1507,17 @@ class WebMvcAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class CustomExceptionResolverConfiguration {
|
||||
static class CustomExceptionHandlerConfiguration {
|
||||
|
||||
@Bean
|
||||
CustomExceptionResolver customExceptionResolver() {
|
||||
return new CustomExceptionResolver();
|
||||
CustomExceptionHandler customExceptionHandler() {
|
||||
return new CustomExceptionHandler();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ControllerAdvice
|
||||
static class CustomExceptionResolver extends ResponseEntityExceptionHandler {
|
||||
static class CustomExceptionHandler extends ResponseEntityExceptionHandler {
|
||||
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public abstract class ProcessAot extends AbstractAot {
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add(getApplicationClass().get());
|
||||
args.addAll(processorArgs());
|
||||
this.setArgs(args);
|
||||
setArgs(args);
|
||||
super.exec();
|
||||
}
|
||||
|
||||
|
@ -70,11 +70,11 @@ public class ProcessTestAot extends AbstractAot {
|
||||
@TaskAction
|
||||
public void exec() {
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add(this.getClasspathRoots().getFiles().stream().filter(File::exists).map(File::getAbsolutePath)
|
||||
args.add(getClasspathRoots().getFiles().stream().filter(File::exists).map(File::getAbsolutePath)
|
||||
.collect(Collectors.joining(File.pathSeparator)));
|
||||
args.addAll(processorArgs());
|
||||
this.setArgs(args);
|
||||
this.classpath(this.junitPlatformLauncher);
|
||||
setArgs(args);
|
||||
classpath(this.junitPlatformLauncher);
|
||||
super.exec();
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ public abstract class BootBuildImage extends DefaultTask {
|
||||
}
|
||||
|
||||
private BuildRequest customizeBuilder(BuildRequest request) {
|
||||
String builder = this.getBuilder().getOrNull();
|
||||
String builder = getBuilder().getOrNull();
|
||||
if (StringUtils.hasText(builder)) {
|
||||
return request.withBuilder(ImageReference.of(builder));
|
||||
}
|
||||
@ -316,7 +316,7 @@ public abstract class BootBuildImage extends DefaultTask {
|
||||
}
|
||||
|
||||
private BuildRequest customizeRunImage(BuildRequest request) {
|
||||
String runImage = this.getRunImage().getOrNull();
|
||||
String runImage = getRunImage().getOrNull();
|
||||
if (StringUtils.hasText(runImage)) {
|
||||
return request.withRunImage(ImageReference.of(runImage));
|
||||
}
|
||||
@ -324,7 +324,7 @@ public abstract class BootBuildImage extends DefaultTask {
|
||||
}
|
||||
|
||||
private BuildRequest customizeEnvironment(BuildRequest request) {
|
||||
Map<String, String> environment = this.getEnvironment().getOrNull();
|
||||
Map<String, String> environment = getEnvironment().getOrNull();
|
||||
if (environment != null && !environment.isEmpty()) {
|
||||
request = request.withEnv(environment);
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public abstract class DockerSpec {
|
||||
}
|
||||
|
||||
boolean hasTokenAuth() {
|
||||
return this.getToken().isPresent();
|
||||
return getToken().isPresent();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public abstract class BootRun extends JavaExec {
|
||||
|
||||
@Override
|
||||
public void exec() {
|
||||
if (this.getOptimizedLaunch().get()) {
|
||||
if (getOptimizedLaunch().get()) {
|
||||
setJvmArgs(getJvmArgs());
|
||||
jvmArgs("-XX:TieredStopAtLevel=1");
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class BufferedStartupStep implements StartupStep {
|
||||
|
||||
@Override
|
||||
public StartupStep tag(String key, Supplier<String> value) {
|
||||
return this.tag(key, value.get());
|
||||
return tag(key, value.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -264,7 +264,7 @@ public enum PeriodStyle {
|
||||
}
|
||||
|
||||
private int intValue(Period value) {
|
||||
Assert.notNull(this.intValue, () -> "intValue cannot be extracted from " + this.name());
|
||||
Assert.notNull(this.intValue, () -> "intValue cannot be extracted from " + name());
|
||||
return this.intValue.apply(value);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class ReactiveWebServerApplicationContext extends GenericReactiveWebAppli
|
||||
private void createWebServer() {
|
||||
WebServerManager serverManager = this.serverManager;
|
||||
if (serverManager == null) {
|
||||
StartupStep createWebServer = this.getApplicationStartup().start("spring.boot.webserver.create");
|
||||
StartupStep createWebServer = getApplicationStartup().start("spring.boot.webserver.create");
|
||||
String webServerFactoryBeanName = getWebServerFactoryBeanName();
|
||||
ReactiveWebServerFactory webServerFactory = getWebServerFactory(webServerFactoryBeanName);
|
||||
createWebServer.tag("factory", webServerFactory.getClass().toString());
|
||||
|
@ -177,7 +177,7 @@ public class ServletWebServerApplicationContext extends GenericWebApplicationCon
|
||||
WebServer webServer = this.webServer;
|
||||
ServletContext servletContext = getServletContext();
|
||||
if (webServer == null && servletContext == null) {
|
||||
StartupStep createWebServer = this.getApplicationStartup().start("spring.boot.webserver.create");
|
||||
StartupStep createWebServer = getApplicationStartup().start("spring.boot.webserver.create");
|
||||
ServletWebServerFactory factory = getWebServerFactory();
|
||||
createWebServer.tag("factory", factory.getClass().toString());
|
||||
this.webServer = factory.getWebServer(getSelfInitializer());
|
||||
|
@ -69,7 +69,7 @@ public class SampleSessionRedisApplicationTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
void sessionsEndpointShouldReturnUserSessions() {
|
||||
performLogin();
|
||||
ResponseEntity<Map<String, Object>> response = this.getSessions();
|
||||
ResponseEntity<Map<String, Object>> response = getSessions();
|
||||
assertThat(response).isNotNull();
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
List<Map<String, Object>> sessions = (List<Map<String, Object>>) response.getBody().get("sessions");
|
||||
|
Loading…
Reference in New Issue
Block a user