This commit is contained in:
Phillip Webb 2018-02-12 10:02:51 -08:00
parent e49d50fe9d
commit 0348889fd7
11 changed files with 27 additions and 24 deletions

View File

@ -82,7 +82,6 @@ public class JmxEndpointProperties {
return this.staticNames; return this.staticNames;
} }
public static class Exposure { public static class Exposure {
/** /**

View File

@ -47,12 +47,6 @@ import org.springframework.context.annotation.Configuration;
@EnableConfigurationProperties(NewRelicProperties.class) @EnableConfigurationProperties(NewRelicProperties.class)
public class NewRelicMetricsExportAutoConfiguration { public class NewRelicMetricsExportAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public Clock micrometerClock() {
return Clock.SYSTEM;
}
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public NewRelicConfig newRelicConfig(NewRelicProperties props) { public NewRelicConfig newRelicConfig(NewRelicProperties props) {

View File

@ -36,7 +36,6 @@ public class InvocationContext {
/** /**
* Creates a new context for an operation being invoked by the given {@code principal} * Creates a new context for an operation being invoked by the given {@code principal}
* with the given available {@code arguments}. * with the given available {@code arguments}.
*
* @param principal the principal invoking the operation. May be {@code null} * @param principal the principal invoking the operation. May be {@code null}
* @param arguments the arguments available to the operation. Never {@code null} * @param arguments the arguments available to the operation. Never {@code null}
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -48,7 +48,8 @@ import org.springframework.data.mongodb.core.convert.MongoConverter;
@Configuration @Configuration
@ConditionalOnClass({ MongoClient.class, ReactiveMongoTemplate.class }) @ConditionalOnClass({ MongoClient.class, ReactiveMongoTemplate.class })
@EnableConfigurationProperties(MongoProperties.class) @EnableConfigurationProperties(MongoProperties.class)
@AutoConfigureAfter({ MongoReactiveAutoConfiguration.class, MongoDataAutoConfiguration.class }) @AutoConfigureAfter({ MongoReactiveAutoConfiguration.class,
MongoDataAutoConfiguration.class })
public class MongoReactiveDataAutoConfiguration { public class MongoReactiveDataAutoConfiguration {
private final MongoProperties properties; private final MongoProperties properties;

View File

@ -51,17 +51,24 @@ class DataSourceBeanCreationFailureAnalyzer
} }
private FailureAnalysis getFailureAnalysis(DataSourceBeanCreationException cause) { private FailureAnalysis getFailureAnalysis(DataSourceBeanCreationException cause) {
String description = getDescription(cause);
String action = getAction(cause);
return new FailureAnalysis(description, action, cause);
}
private String getDescription(DataSourceBeanCreationException cause) {
StringBuilder description = new StringBuilder(); StringBuilder description = new StringBuilder();
boolean datasourceUrlSpecified = this.environment.containsProperty(
"spring.datasource.url");
description.append("Failed to auto-configure a DataSource: "); description.append("Failed to auto-configure a DataSource: ");
if (!datasourceUrlSpecified) { if (!this.environment.containsProperty("spring.datasource.url")) {
description.append("'spring.datasource.url' is not specified and "); description.append("'spring.datasource.url' is not specified and ");
} }
description.append(String.format( description.append(
"no embedded datasource could be auto-configured.%n")); String.format("no embedded datasource could be auto-configured.%n"));
description.append(String.format("%nReason: %s%n", cause.getMessage())); description.append(String.format("%nReason: %s%n", cause.getMessage()));
return description.toString();
}
private String getAction(DataSourceBeanCreationException cause) {
StringBuilder action = new StringBuilder(); StringBuilder action = new StringBuilder();
action.append(String.format("Consider the following:%n")); action.append(String.format("Consider the following:%n"));
if (EmbeddedDatabaseConnection.NONE == cause.getConnection()) { if (EmbeddedDatabaseConnection.NONE == cause.getConnection()) {
@ -69,11 +76,12 @@ class DataSourceBeanCreationFailureAnalyzer
+ "Derby), please put it on the classpath.%n")); + "Derby), please put it on the classpath.%n"));
} }
else { else {
action.append(String.format("\tReview the configuration of %s%n.", cause.getConnection())); action.append(String.format("\tReview the configuration of %s%n.",
cause.getConnection()));
} }
action.append("\tIf you have database settings to be loaded from a particular " action.append("\tIf you have database settings to be loaded from a particular "
+ "profile you may need to activate it").append(getActiveProfiles()); + "profile you may need to activate it").append(getActiveProfiles());
return new FailureAnalysis(description.toString(), action.toString(), cause); return action.toString();
} }
private String getActiveProfiles() { private String getActiveProfiles() {

View File

@ -47,8 +47,7 @@ import org.springframework.util.StringUtils;
* @since 1.1.0 * @since 1.1.0
*/ */
@ConfigurationProperties(prefix = "spring.datasource") @ConfigurationProperties(prefix = "spring.datasource")
public class DataSourceProperties public class DataSourceProperties implements BeanClassLoaderAware, InitializingBean {
implements BeanClassLoaderAware, InitializingBean {
private ClassLoader classLoader; private ClassLoader classLoader;

View File

@ -5990,6 +5990,8 @@ TIP: Do not forget to add `@RunWith(SpringRunner.class)` to your test. Otherwise
annotations are ignored. annotations are ignored.
[[boot-features-testing-spring-boot-applications-detecting-web-app-type]]
==== Detecting Web Application Type ==== Detecting Web Application Type
If Spring MVC is available, a regular MVC-based application context is configured. If you If Spring MVC is available, a regular MVC-based application context is configured. If you
have only Spring WebFlux, we'll detect that and configure a WebFlux-based application have only Spring WebFlux, we'll detect that and configure a WebFlux-based application

View File

@ -125,9 +125,10 @@ public class TestRestTemplate {
* @param httpClientOptions client options to use if the Apache HTTP Client is used * @param httpClientOptions client options to use if the Apache HTTP Client is used
* @since 2.0.0 * @since 2.0.0
*/ */
public TestRestTemplate(RestTemplateBuilder restTemplateBuilder, String username, String password, public TestRestTemplate(RestTemplateBuilder restTemplateBuilder, String username,
HttpClientOption... httpClientOptions) { String password, HttpClientOption... httpClientOptions) {
this(buildRestTemplate(restTemplateBuilder), username, password, httpClientOptions); this(buildRestTemplate(restTemplateBuilder), username, password,
httpClientOptions);
} }
private TestRestTemplate(RestTemplate restTemplate, String username, String password, private TestRestTemplate(RestTemplate restTemplate, String username, String password,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.