Commit d510bc71 authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Polish

Closes gh-14271
parent 7dff13b6
...@@ -669,7 +669,7 @@ public class KafkaProperties { ...@@ -669,7 +669,7 @@ public class KafkaProperties {
/** /**
* Comma-delimited list of host:port pairs to use for establishing the initial * Comma-delimited list of host:port pairs to use for establishing the initial
* connection to the Kafka cluster. Overrides the global property, for streams. * connections to the Kafka cluster. Overrides the global property, for streams.
*/ */
private List<String> bootstrapServers; private List<String> bootstrapServers;
......
...@@ -41,7 +41,7 @@ public class ClientsConfiguredCondition extends SpringBootCondition { ...@@ -41,7 +41,7 @@ public class ClientsConfiguredCondition extends SpringBootCondition {
private static final Bindable<Map<String, OAuth2ClientProperties.LoginClientRegistration>> STRING_LOGIN_REGISTRATION_MAP = Bindable private static final Bindable<Map<String, OAuth2ClientProperties.LoginClientRegistration>> STRING_LOGIN_REGISTRATION_MAP = Bindable
.mapOf(String.class, OAuth2ClientProperties.LoginClientRegistration.class); .mapOf(String.class, OAuth2ClientProperties.LoginClientRegistration.class);
private static final Bindable<Map<String, OAuth2ClientProperties.AuthorizationCodeClientRegistration>> STRING_AUTHORIZATIONCODE_REGISTRATION_MAP = Bindable private static final Bindable<Map<String, OAuth2ClientProperties.AuthorizationCodeClientRegistration>> STRING_AUTHORIZATION_CODE_REGISTRATION_MAP = Bindable
.mapOf(String.class, .mapOf(String.class,
OAuth2ClientProperties.AuthorizationCodeClientRegistration.class); OAuth2ClientProperties.AuthorizationCodeClientRegistration.class);
...@@ -71,7 +71,7 @@ public class ClientsConfiguredCondition extends SpringBootCondition { ...@@ -71,7 +71,7 @@ public class ClientsConfiguredCondition extends SpringBootCondition {
Map<String, OAuth2ClientProperties.AuthorizationCodeClientRegistration> authCodeClientRegistrations = Binder Map<String, OAuth2ClientProperties.AuthorizationCodeClientRegistration> authCodeClientRegistrations = Binder
.get(environment) .get(environment)
.bind("spring.security.oauth2.client.registration.authorizationcode", .bind("spring.security.oauth2.client.registration.authorizationcode",
STRING_AUTHORIZATIONCODE_REGISTRATION_MAP) STRING_AUTHORIZATION_CODE_REGISTRATION_MAP)
.orElse(Collections.emptyMap()); .orElse(Collections.emptyMap());
registrations.putAll(loginClientRegistrations); registrations.putAll(loginClientRegistrations);
registrations.putAll(authCodeClientRegistrations); registrations.putAll(authCodeClientRegistrations);
......
...@@ -307,7 +307,7 @@ public class KafkaAutoConfigurationTests { ...@@ -307,7 +307,7 @@ public class KafkaAutoConfigurationTests {
Properties configs = context.getBean( Properties configs = context.getBean(
KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME, KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME,
KafkaStreamsConfiguration.class).asProperties(); KafkaStreamsConfiguration.class).asProperties();
assertThat(configs.get(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG)) assertThat(configs.get(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG))
.isEqualTo("localhost:9092, localhost:9093"); .isEqualTo("localhost:9092, localhost:9093");
assertThat( assertThat(
configs.get(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG)) configs.get(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG))
...@@ -357,7 +357,7 @@ public class KafkaAutoConfigurationTests { ...@@ -357,7 +357,7 @@ public class KafkaAutoConfigurationTests {
Properties configs = context.getBean( Properties configs = context.getBean(
KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME, KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME,
KafkaStreamsConfiguration.class).asProperties(); KafkaStreamsConfiguration.class).asProperties();
assertThat(configs.get(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG)) assertThat(configs.get(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG))
.isEqualTo("localhost:9092, localhost:9093"); .isEqualTo("localhost:9092, localhost:9093");
assertThat(configs.get(StreamsConfig.APPLICATION_ID_CONFIG)) assertThat(configs.get(StreamsConfig.APPLICATION_ID_CONFIG))
.isEqualTo("my-test-app"); .isEqualTo("my-test-app");
...@@ -376,7 +376,7 @@ public class KafkaAutoConfigurationTests { ...@@ -376,7 +376,7 @@ public class KafkaAutoConfigurationTests {
Properties configs = context.getBean( Properties configs = context.getBean(
KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME, KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME,
KafkaStreamsConfiguration.class).asProperties(); KafkaStreamsConfiguration.class).asProperties();
assertThat(configs.get(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG)) assertThat(configs.get(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG))
.isEqualTo("localhost:9094, localhost:9095"); .isEqualTo("localhost:9094, localhost:9095");
assertThat(configs.get(StreamsConfig.APPLICATION_ID_CONFIG)) assertThat(configs.get(StreamsConfig.APPLICATION_ID_CONFIG))
.isEqualTo("test-id"); .isEqualTo("test-id");
...@@ -628,7 +628,7 @@ public class KafkaAutoConfigurationTests { ...@@ -628,7 +628,7 @@ public class KafkaAutoConfigurationTests {
@Bean(name = KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME) @Bean(name = KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME)
public KafkaStreamsConfiguration kafkaStreamsConfiguration() { public KafkaStreamsConfiguration kafkaStreamsConfiguration() {
Map<String, Object> streamsProperties = new HashMap<>(); Map<String, Object> streamsProperties = new HashMap<>();
streamsProperties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, streamsProperties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG,
"localhost:9094, localhost:9095"); "localhost:9094, localhost:9095");
streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, "test-id"); streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, "test-id");
......
...@@ -236,7 +236,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests { ...@@ -236,7 +236,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
} }
@Test @Test
public void getClientRegistrationsWhenAuhtorizationCodeClientShouldAdapt() { public void getClientRegistrationsWhenAuthorizationCodeClientShouldAdapt() {
OAuth2ClientProperties properties = new OAuth2ClientProperties(); OAuth2ClientProperties properties = new OAuth2ClientProperties();
OAuth2ClientProperties.AuthorizationCodeClientRegistration registration = new OAuth2ClientProperties.AuthorizationCodeClientRegistration(); OAuth2ClientProperties.AuthorizationCodeClientRegistration registration = new OAuth2ClientProperties.AuthorizationCodeClientRegistration();
registration.setClientId("clientId"); registration.setClientId("clientId");
......
...@@ -26,7 +26,6 @@ import java.util.ArrayList; ...@@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Supplier;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -96,25 +95,24 @@ public class BasicErrorControllerIntegrationTests { ...@@ -96,25 +95,24 @@ public class BasicErrorControllerIntegrationTests {
@Test @Test
public void testErrorForMachineClientTraceParamTrue() { public void testErrorForMachineClientTraceParamTrue() {
errorForMachineClientOnTraceParam(() -> createUrl("?trace=true"), true); errorForMachineClientOnTraceParam("?trace=true", true);
} }
@Test @Test
public void testErrorForMachineClientTraceParamFalse() { public void testErrorForMachineClientTraceParamFalse() {
errorForMachineClientOnTraceParam(() -> createUrl("?trace=false"), false); errorForMachineClientOnTraceParam("?trace=false", false);
} }
@Test @Test
public void testErrorForMachineClientTraceParamAbsent() { public void testErrorForMachineClientTraceParamAbsent() {
errorForMachineClientOnTraceParam(() -> createUrl(""), false); errorForMachineClientOnTraceParam("", false);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private void errorForMachineClientOnTraceParam(Supplier<String> url, private void errorForMachineClientOnTraceParam(String path, boolean expectedTrace) {
boolean expectedTrace) {
load("--server.error.include-exception=true", load("--server.error.include-exception=true",
"--server.error.include-stacktrace=on-trace-param"); "--server.error.include-stacktrace=on-trace-param");
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(url.get(), ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(createUrl(path),
Map.class); Map.class);
assertErrorAttributes(entity.getBody(), "500", "Internal Server Error", assertErrorAttributes(entity.getBody(), "500", "Internal Server Error",
IllegalStateException.class, "Expected!", "/"); IllegalStateException.class, "Expected!", "/");
......
...@@ -549,7 +549,7 @@ content into your application. Rather, pick only the properties that you need. ...@@ -549,7 +549,7 @@ content into your application. Rather, pick only the properties that you need.
spring.flyway.baseline-description= # spring.flyway.baseline-description= #
spring.flyway.baseline-on-migrate= # spring.flyway.baseline-on-migrate= #
spring.flyway.baseline-version=1 # Version to start migration spring.flyway.baseline-version=1 # Version to start migration
spring.flyway.batch = # spring.flyway.batch= #
spring.flyway.check-location=true # Whether to check that migration scripts location exists. spring.flyway.check-location=true # Whether to check that migration scripts location exists.
spring.flyway.clean-disabled= # spring.flyway.clean-disabled= #
spring.flyway.clean-on-validation-error= # spring.flyway.clean-on-validation-error= #
...@@ -1106,9 +1106,9 @@ content into your application. Rather, pick only the properties that you need. ...@@ -1106,9 +1106,9 @@ content into your application. Rather, pick only the properties that you need.
spring.kafka.ssl.trust-store-location= # Location of the trust store file. spring.kafka.ssl.trust-store-location= # Location of the trust store file.
spring.kafka.ssl.trust-store-password= # Store password for the trust store file. spring.kafka.ssl.trust-store-password= # Store password for the trust store file.
spring.kafka.ssl.trust-store-type= # Type of the trust store. spring.kafka.ssl.trust-store-type= # Type of the trust store.
spring.kafka.streams.application-id = # Kafka streams application.id property; default spring.application.name. spring.kafka.streams.application-id= # Kafka streams application.id property; default spring.application.name.
spring.kafka.streams.auto-startup=true # Whether or not to auto-start the streams factory bean. spring.kafka.streams.auto-startup=true # Whether or not to auto-start the streams factory bean.
spring.kafka.streams.bootstrap-servers= # Comma-delimited list of host:port pairs to use for establishing the initial connection to the Kafka cluster. Overrides the global property, for streams. spring.kafka.streams.bootstrap-servers= # Comma-delimited list of host:port pairs to use for establishing the initial connections to the Kafka cluster. Overrides the global property, for streams.
spring.kafka.streams.cache-max-bytes-buffering= # Maximum number of memory bytes to be used for buffering across all threads. spring.kafka.streams.cache-max-bytes-buffering= # Maximum number of memory bytes to be used for buffering across all threads.
spring.kafka.streams.client-id= # ID to pass to the server when making requests. Used for server-side logging. spring.kafka.streams.client-id= # ID to pass to the server when making requests. Used for server-side logging.
spring.kafka.streams.properties.*= # Additional Kafka properties used to configure the streams. spring.kafka.streams.properties.*= # Additional Kafka properties used to configure the streams.
......
...@@ -1326,7 +1326,7 @@ source for more details. ...@@ -1326,7 +1326,7 @@ source for more details.
[[howto-switch-off-the-spring-mvc-dispatcherservlet]] [[howto-switch-off-the-spring-mvc-dispatcherservlet]]
=== Switch Off the Spring MVC DispatcherServlet === Switch Off the Spring MVC DispatcherServlet
By default, All content is served from the root of your application (`/`) down. If you By default, all content is served from the root of your application (`/`). If you
would rather map to a different path, you can configure one as follows: would rather map to a different path, you can configure one as follows:
[source,properties,indent=0,subs="verbatim"] [source,properties,indent=0,subs="verbatim"]
...@@ -1334,7 +1334,7 @@ would rather map to a different path, you can configure one as follows: ...@@ -1334,7 +1334,7 @@ would rather map to a different path, you can configure one as follows:
spring.mvc.servlet.path=/acme spring.mvc.servlet.path=/acme
---- ----
If you have additional servlets you can declare a `@Bean` of type `Servlet` or If you have additional servlets you can declare a `@Bean` of type `Servlet` or
`ServletRegistrationBean` for each and Spring Boot will register them transparently to the `ServletRegistrationBean` for each and Spring Boot will register them transparently to the
container. Because servlets are registered that way, they can be mapped to a sub-context container. Because servlets are registered that way, they can be mapped to a sub-context
of the `DispatcherServlet` without invoking it. of the `DispatcherServlet` without invoking it.
......
...@@ -5701,12 +5701,12 @@ reference the auto-configured `KafkaTransactionManager` bean. ...@@ -5701,12 +5701,12 @@ reference the auto-configured `KafkaTransactionManager` bean.
==== Kafka Streams ==== Kafka Streams
Spring for Apache Kafka provides a factory bean to create a `StreamsBuilder` object and Spring for Apache Kafka provides a factory bean to create a `StreamsBuilder` object and
manage the lifecycle of its streams. Spring Boot auto-configures the required manage the lifecycle of its streams. Spring Boot auto-configures the required
`KafkaStreamsConfiguration` bean as long as `kafka-streams` in on the classpath and kafka `KafkaStreamsConfiguration` bean as long as `kafka-streams` is on the classpath and Kafka
streams is enabled via the `@EnableKafkaStreams` annotation. Streams is enabled via the `@EnableKafkaStreams` annotation.
Enabling Kafka Streams means that the application id and bootstrap servers must be set. Enabling Kafka Streams means that the application id and bootstrap servers must be set.
The former can be configured using `spring.kafka.streams.application-id`, defaulting to The former can be configured using `spring.kafka.streams.application-id`, defaulting to
`spring.application.name` if not set. The later can be set globally or `spring.application.name` if not set. The latter can be set globally or
specifically overridden just for streams. specifically overridden just for streams.
Several additional properties are available using dedicated properties; other arbitrary Several additional properties are available using dedicated properties; other arbitrary
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment