mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge pull request #40034 from izeye
* pr/40034: Polish Closes gh-40034
This commit is contained in:
commit
2dc30d90e3
@ -1,7 +1,7 @@
|
||||
# Failure Analyzers
|
||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.ValidationFailureAnalyzer,\
|
||||
org.springframework.boot.actuate.autoconfigure.health.NoSuchHealthContributorFailureAnalyzer
|
||||
org.springframework.boot.actuate.autoconfigure.health.NoSuchHealthContributorFailureAnalyzer,\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.ValidationFailureAnalyzer
|
||||
|
||||
# Environment Post Processors
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=\
|
||||
|
@ -151,7 +151,7 @@ public class LiquibaseProperties {
|
||||
/**
|
||||
* Which UIService to use.
|
||||
*/
|
||||
private UIService uiService;
|
||||
private UiService uiService;
|
||||
|
||||
public String getChangeLog() {
|
||||
return this.changeLog;
|
||||
@ -322,11 +322,11 @@ public class LiquibaseProperties {
|
||||
this.showSummaryOutput = showSummaryOutput;
|
||||
}
|
||||
|
||||
public UIService getUiService() {
|
||||
public UiService getUiService() {
|
||||
return this.uiService;
|
||||
}
|
||||
|
||||
public void setUiService(UIService uiService) {
|
||||
public void setUiService(UiService uiService) {
|
||||
this.uiService = uiService;
|
||||
}
|
||||
|
||||
@ -386,10 +386,8 @@ public class LiquibaseProperties {
|
||||
* Enumeration of types of UIService. Values are the same as those on
|
||||
* {@link UIServiceEnum}. To maximize backwards compatibility, the Liquibase enum is
|
||||
* not used directly.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*/
|
||||
public enum UIService {
|
||||
public enum UiService {
|
||||
|
||||
/**
|
||||
* Console-based UIService.
|
||||
|
@ -26,7 +26,6 @@ import java.util.List;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.source.InvalidConfigurationPropertyValueException;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
@ -83,19 +82,17 @@ public class OAuth2ResourceServerProperties {
|
||||
private List<String> audiences = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Prefix to use for {@link GrantedAuthority authorities} mapped from JWT.
|
||||
* Prefix to use for authorities mapped from JWT.
|
||||
*/
|
||||
private String authorityPrefix;
|
||||
|
||||
/**
|
||||
* Regex to use for splitting the value of the authorities claim into
|
||||
* {@link GrantedAuthority authorities}.
|
||||
* Regex to use for splitting the value of the authorities claim into authorities.
|
||||
*/
|
||||
private String authoritiesClaimDelimiter;
|
||||
|
||||
/**
|
||||
* Name of token claim to use for mapping {@link GrantedAuthority authorities}
|
||||
* from JWT.
|
||||
* Name of token claim to use for mapping authorities from JWT.
|
||||
*/
|
||||
private String authoritiesClaimName;
|
||||
|
||||
|
@ -31,9 +31,9 @@ class Oauth2ResourceServerConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(JwtDecoder.class)
|
||||
@Import({ OAuth2ResourceServerJwtConfiguration.JwtDecoderConfiguration.class,
|
||||
OAuth2ResourceServerJwtConfiguration.OAuth2SecurityFilterChainConfiguration.class,
|
||||
OAuth2ResourceServerJwtConfiguration.JwtConverterConfiguration.class })
|
||||
@Import({ OAuth2ResourceServerJwtConfiguration.JwtConverterConfiguration.class,
|
||||
OAuth2ResourceServerJwtConfiguration.JwtDecoderConfiguration.class,
|
||||
OAuth2ResourceServerJwtConfiguration.OAuth2SecurityFilterChainConfiguration.class })
|
||||
static class JwtConfiguration {
|
||||
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ public class ServerProperties {
|
||||
private Duration timeout = Duration.ofMinutes(30);
|
||||
|
||||
/**
|
||||
* The maximum number of sessions that can be stored.
|
||||
* Maximum number of sessions that can be stored.
|
||||
*/
|
||||
private int maxSessions = 10000;
|
||||
|
||||
|
@ -61,14 +61,12 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.test.City;
|
||||
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizationAutoConfiguration;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer;
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
import org.springframework.boot.sql.init.DatabaseInitializationMode;
|
||||
import org.springframework.boot.sql.init.DatabaseInitializationSettings;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
@ -117,8 +115,7 @@ class BatchAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void testDefaultContext() {
|
||||
this.contextRunner.withInitializer(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.INFO))
|
||||
.withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class)
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class)
|
||||
.run((context) -> {
|
||||
assertThat(context).hasSingleBean(JobRepository.class);
|
||||
assertThat(context).hasSingleBean(JobLauncher.class);
|
||||
|
@ -29,10 +29,8 @@ import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
|
||||
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration.SpringBootBatchConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.test.City;
|
||||
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
import org.springframework.boot.sql.init.DatabaseInitializationMode;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||
@ -57,7 +55,6 @@ class BatchAutoConfigurationWithoutJpaTests {
|
||||
void jdbcWithDefaultSettings() {
|
||||
this.contextRunner.withUserConfiguration(DefaultConfiguration.class, EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.datasource.generate-unique-name=true")
|
||||
.withInitializer(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.INFO))
|
||||
.run((context) -> {
|
||||
assertThat(context).hasSingleBean(JobLauncher.class);
|
||||
assertThat(context).hasSingleBean(JobExplorer.class);
|
||||
|
@ -32,8 +32,6 @@ import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.ReactiveElasticsearchClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -67,8 +65,7 @@ class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
|
||||
ReactiveElasticsearchClientAutoConfiguration.class))
|
||||
.withPropertyValues(
|
||||
"spring.elasticsearch.uris=" + elasticsearch.getHost() + ":" + elasticsearch.getFirstMappedPort(),
|
||||
"spring.elasticsearch.socket-timeout=30s")
|
||||
.withInitializer(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.INFO));
|
||||
"spring.elasticsearch.socket-timeout=30s");
|
||||
|
||||
@Test
|
||||
void testDefaultRepositoryConfiguration() {
|
||||
|
@ -417,10 +417,8 @@ class LiquibaseAutoConfigurationTests {
|
||||
void overrideUiService() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.liquibase.ui-service=console")
|
||||
.run(assertLiquibase((liquibase) -> {
|
||||
UIServiceEnum uiService = (UIServiceEnum) ReflectionTestUtils.getField(liquibase, "uiService");
|
||||
assertThat(uiService).isEqualTo(UIServiceEnum.CONSOLE);
|
||||
}));
|
||||
.run(assertLiquibase(
|
||||
(liquibase) -> assertThat(liquibase).extracting("uiService").isEqualTo(UIServiceEnum.CONSOLE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties.ShowSummary;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties.ShowSummaryOutput;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties.UIService;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties.UiService;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ -49,7 +49,7 @@ class LiquibasePropertiesTests {
|
||||
|
||||
@Test
|
||||
void valuesOfUiServiceMatchValuesOfUiServiceEnum() {
|
||||
assertThat(namesOf(UIService.values())).isEqualTo(namesOf(UIServiceEnum.values()));
|
||||
assertThat(namesOf(UiService.values())).isEqualTo(namesOf(UIServiceEnum.values()));
|
||||
}
|
||||
|
||||
private List<String> namesOf(Enum<?>[] input) {
|
||||
|
@ -23,10 +23,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
|
||||
import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
@ -183,7 +181,6 @@ class UserDetailsServiceAutoConfigurationTests {
|
||||
this.contextRunner
|
||||
.withClassLoader(new FilteredClassLoader(ClientRegistrationRepository.class, OpaqueTokenIntrospector.class))
|
||||
.withPropertyValues("spring.security.user.name=alice")
|
||||
.withInitializer(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.INFO))
|
||||
.run(((context) -> assertThat(context).hasSingleBean(InMemoryUserDetailsManager.class)));
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration;
|
||||
import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer;
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
import org.springframework.boot.r2dbc.init.R2dbcScriptDatabaseInitializer;
|
||||
import org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer;
|
||||
import org.springframework.boot.sql.init.DatabaseInitializationSettings;
|
||||
@ -66,7 +64,6 @@ class SqlInitializationAutoConfigurationTests {
|
||||
@Test
|
||||
void whenConnectionFactoryIsAvailableAndModeIsNeverThenInitializerIsNotAutoConfigured() {
|
||||
this.contextRunner.withConfiguration(AutoConfigurations.of(R2dbcAutoConfiguration.class))
|
||||
.withInitializer(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.INFO))
|
||||
.withPropertyValues("spring.sql.init.mode:never")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(AbstractScriptDatabaseInitializer.class));
|
||||
}
|
||||
|
@ -99,4 +99,4 @@ The next sections will provide more details about logging, metrics and traces.
|
||||
== Micrometer Observation Annotations support
|
||||
|
||||
To enable scanning of metrics and tracing annotations like `@Timed`, `@Counted`, `@MeterTag` and `@NewSpan` annotations, you will need to set the configprop:management.observations.annotations.enabled[] property to `true`.
|
||||
This feature is supported Micrometer directly, please refer to the {url-micrometer-docs-concepts}#_the_timed_annotation[Micrometer] and {url-micrometer-tracing-docs}/api.html#_aspect_oriented_programming[Micrometer Tracing] reference docs.
|
||||
This feature is supported Micrometer directly. Please refer to the {url-micrometer-docs-concepts}#_the_timed_annotation[Micrometer] and {url-micrometer-tracing-docs}/api.html#_aspect_oriented_programming[Micrometer Tracing] reference docs.
|
||||
|
@ -135,7 +135,7 @@ If you define your own `DataSource` bean, auto-configuration does not occur.
|
||||
The following connection pools are supported by `DataSourceBuilder`:
|
||||
|
||||
* HikariCP
|
||||
* Tomcat pooling `Datasource`
|
||||
* Tomcat pooling `DataSource`
|
||||
* Commons DBCP2
|
||||
* Oracle UCP & `OracleDataSource`
|
||||
* Spring Framework's `SimpleDriverDataSource`
|
||||
|
Loading…
Reference in New Issue
Block a user