diff --git a/buildSrc/src/main/java/org/springframework/boot/build/AsciidoctorConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/AsciidoctorConventions.java index 7dcd8776ad..0950f456e2 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/AsciidoctorConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/AsciidoctorConventions.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2012-2021 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. @@ -110,7 +110,7 @@ class AsciidoctorConventions { asciidoctorTask.baseDirFollowsSourceDir(); createSyncDocumentationSourceTask(project, asciidoctorTask); if (asciidoctorTask instanceof AsciidoctorTask) { - configureAsciidoctorHtmlTask(project, (AsciidoctorTask) asciidoctorTask); + configureAsciidoctorHtmlTask((AsciidoctorTask) asciidoctorTask); } } @@ -144,7 +144,7 @@ class AsciidoctorConventions { return syncDocumentationSource; } - private void configureAsciidoctorHtmlTask(Project project, AsciidoctorTask asciidoctorTask) { + private void configureAsciidoctorHtmlTask(AsciidoctorTask asciidoctorTask) { asciidoctorTask.outputOptions((outputOptions) -> outputOptions.backends("spring-html")); } diff --git a/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java index 39a621bd0a..9292402ccb 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -22,6 +22,7 @@ import org.gradle.api.attributes.Usage; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.publish.PublishingExtension; +import org.gradle.api.publish.VariantVersionMappingStrategy; import org.gradle.api.publish.maven.MavenPom; import org.gradle.api.publish.maven.MavenPomDeveloperSpec; import org.gradle.api.publish.maven.MavenPomIssueManagement; @@ -78,8 +79,7 @@ class MavenPublishingConventions { private void customizeMavenPublication(MavenPublication publication, Project project) { customizePom(publication.getPom(), project); - project.getPlugins().withType(JavaPlugin.class) - .all((javaPlugin) -> customizeJavaMavenPublication(publication, project)); + project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> customizeJavaMavenPublication(publication)); } private void customizePom(MavenPom pom, Project project) { @@ -97,11 +97,11 @@ class MavenPublishingConventions { } } - private void customizeJavaMavenPublication(MavenPublication publication, Project project) { + private void customizeJavaMavenPublication(MavenPublication publication) { publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy .fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME))); - publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_RUNTIME, - (mappingStrategy) -> mappingStrategy.fromResolutionResult())); + publication.versionMapping( + (strategy) -> strategy.usage(Usage.JAVA_RUNTIME, VariantVersionMappingStrategy::fromResolutionResult)); } private void customizeOrganization(MavenPomOrganization organization) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationConfiguration.java index a49edd5870..f495550f68 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationConfiguration.java @@ -49,7 +49,6 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.DependsOn; import org.springframework.core.env.Environment; import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.jdbc.datasource.SimpleDriverDataSource; import org.springframework.util.StringUtils; @@ -63,8 +62,7 @@ import org.springframework.util.StringUtils; @Deprecated class DataSourceInitializationConfiguration { - private static DataSource determineDataSource(Supplier dataSource, String username, String password, - DataSourceProperties properties) { + private static DataSource determineDataSource(Supplier dataSource, String username, String password) { if (StringUtils.hasText(username) && StringUtils.hasText(password)) { DataSourceBuilder.derivedFrom(dataSource.get()).type(SimpleDriverDataSource.class).username(username) .password(password).build(); @@ -92,14 +90,14 @@ class DataSourceInitializationConfiguration { @Bean DataSourceScriptDatabaseInitializer ddlOnlyScriptDataSourceInitializer(ObjectProvider dataSource, - DataSourceProperties properties, ResourceLoader resourceLoader) { + DataSourceProperties properties) { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(scriptLocations(properties.getSchema(), "schema", properties.getPlatform())); settings.setContinueOnError(properties.isContinueOnError()); settings.setSeparator(properties.getSeparator()); settings.setEncoding(properties.getSqlScriptEncoding()); DataSource initializationDataSource = determineDataSource(dataSource::getObject, - properties.getSchemaUsername(), properties.getSchemaPassword(), properties); + properties.getSchemaUsername(), properties.getSchemaPassword()); return new InitializationModeDataSourceScriptDatabaseInitializer(initializationDataSource, settings, properties.getInitializationMode()); } @@ -107,14 +105,14 @@ class DataSourceInitializationConfiguration { @Bean @DependsOn("ddlOnlyScriptDataSourceInitializer") DataSourceScriptDatabaseInitializer dmlOnlyScriptDataSourceInitializer(ObjectProvider dataSource, - DataSourceProperties properties, ResourceLoader resourceLoader) { + DataSourceProperties properties) { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setDataLocations(scriptLocations(properties.getData(), "data", properties.getPlatform())); settings.setContinueOnError(properties.isContinueOnError()); settings.setSeparator(properties.getSeparator()); settings.setEncoding(properties.getSqlScriptEncoding()); DataSource initializationDataSource = determineDataSource(dataSource::getObject, - properties.getDataUsername(), properties.getDataPassword(), properties); + properties.getDataUsername(), properties.getDataPassword()); return new InitializationModeDataSourceScriptDatabaseInitializer(initializationDataSource, settings, properties.getInitializationMode()); } @@ -149,7 +147,7 @@ class DataSourceInitializationConfiguration { @Bean DataSourceScriptDatabaseInitializer scriptDataSourceInitializer(DataSource dataSource, - DataSourceProperties properties, ResourceLoader resourceLoader) { + DataSourceProperties properties) { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(scriptLocations(properties.getSchema(), "schema", properties.getPlatform())); settings.setDataLocations(scriptLocations(properties.getData(), "data", properties.getPlatform())); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java index e40a4e46f4..0c66cf078a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java @@ -217,7 +217,7 @@ class ConfigDataEnvironmentContributors implements Iterable filter, Set options) { boolean failOnInactiveSource = options.contains(BinderOption.FAIL_ON_BIND_TO_INACTIVE_SOURCE); - Iterable sources = () -> getBinderSources(activationContext, + Iterable sources = () -> getBinderSources( filter.and((contributor) -> failOnInactiveSource || contributor.isActive(activationContext))); PlaceholdersResolver placeholdersResolver = new ConfigDataEnvironmentContributorPlaceholdersResolver(this.root, activationContext, failOnInactiveSource); @@ -225,8 +225,7 @@ class ConfigDataEnvironmentContributors implements Iterable getBinderSources(ConfigDataActivationContext activationContext, - Predicate filter) { + private Iterator getBinderSources(Predicate filter) { return this.root.stream().filter(this::hasConfigurationPropertySource).filter(filter) .map(ConfigDataEnvironmentContributor::getConfigurationPropertySource).iterator(); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java index 37be6a3121..e9337c70f1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java @@ -57,11 +57,6 @@ class ConfigDataProperties { * @param activate the activate properties */ ConfigDataProperties(@Name("import") List imports, Activate activate) { - this(imports, activate, Collections.emptyList()); - } - - private ConfigDataProperties(List imports, Activate activate, - List boundProperties) { this.imports = (imports != null) ? imports : Collections.emptyList(); this.activate = activate; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolver.java index 3c2b6a5bf6..156e4a6c03 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLocationResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -52,15 +52,14 @@ public class ConfigTreeConfigDataLocationResolver implements ConfigDataLocationR public List resolve(ConfigDataLocationResolverContext context, ConfigDataLocation location) { try { - return resolve(context, location.getNonPrefixedValue(PREFIX)); + return resolve(location.getNonPrefixedValue(PREFIX)); } catch (IOException ex) { throw new ConfigDataLocationNotFoundException(location, ex); } } - private List resolve(ConfigDataLocationResolverContext context, String location) - throws IOException { + private List resolve(String location) throws IOException { Assert.isTrue(location.endsWith("/"), () -> String.format("Config tree location '%s' must end with '/'", location)); if (!this.resourceLoader.isPattern(location)) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index 6ccb399e9e..dfaa435cf5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -753,7 +753,7 @@ public final class ConfigurationPropertyName implements Comparable appender, LogbackConfigurator config, - String logFile) { + private void setRollingPolicy(RollingFileAppender appender, LogbackConfigurator config) { SizeAndTimeBasedRollingPolicy rollingPolicy = new SizeAndTimeBasedRollingPolicy<>(); rollingPolicy.setContext(config.getContext()); rollingPolicy.setFileNamePattern( diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index 688037d8ec..ec9627dcc5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -151,7 +151,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { new LogbackLoggingSystemProperties(environment, context::putProperty).apply(logFile); LogbackConfigurator configurator = debug ? new DebugLogbackConfigurator(context) : new LogbackConfigurator(context); - new DefaultLogbackConfiguration(initializationContext, logFile).apply(configurator); + new DefaultLogbackConfiguration(logFile).apply(configurator); context.setPackagingDataEnabled(true); }