mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Polish
This commit is contained in:
parent
e29ce3f70b
commit
6a55623910
@ -87,7 +87,7 @@ public class AuditEvent implements Serializable {
|
||||
Assert.notNull(timestamp, "Timestamp must not be null");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
this.timestamp = timestamp;
|
||||
this.principal = principal != null ? principal : "";
|
||||
this.principal = (principal != null ? principal : "");
|
||||
this.type = type;
|
||||
this.data = Collections.unmodifiableMap(data);
|
||||
}
|
||||
|
@ -69,9 +69,10 @@ public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> {
|
||||
EnumerablePropertySource<?> enumerable = (EnumerablePropertySource<?>) source;
|
||||
Map<String, Object> properties = new LinkedHashMap<String, Object>();
|
||||
for (String name : enumerable.getPropertyNames()) {
|
||||
Object property = source.getProperty(name);
|
||||
Object resolved = property instanceof String
|
||||
? resolver.resolvePlaceholders((String) property) : property;
|
||||
Object resolved = source.getProperty(name);
|
||||
if (resolved instanceof String) {
|
||||
resolved = resolver.resolvePlaceholders((String) resolved);
|
||||
}
|
||||
properties.put(name, sanitize(name, resolved));
|
||||
}
|
||||
properties = postProcessSourceProperties(sourceName, properties);
|
||||
|
@ -183,7 +183,8 @@ public class EndpointWebMvcHypermediaManagementContextConfigurationTests {
|
||||
static class DocsConfiguration {
|
||||
|
||||
@Bean
|
||||
public DocsMvcEndpoint testDocsMvcEndpoint(ManagementServletContext managementServletContext) {
|
||||
public DocsMvcEndpoint testDocsMvcEndpoint(
|
||||
ManagementServletContext managementServletContext) {
|
||||
return new TestDocsMvcEndpoint(managementServletContext);
|
||||
}
|
||||
|
||||
@ -193,7 +194,8 @@ public class EndpointWebMvcHypermediaManagementContextConfigurationTests {
|
||||
static class HalJsonConfiguration {
|
||||
|
||||
@Bean
|
||||
public HalJsonMvcEndpoint testHalJsonMvcEndpoint(ManagementServletContext managementServletContext) {
|
||||
public HalJsonMvcEndpoint testHalJsonMvcEndpoint(
|
||||
ManagementServletContext managementServletContext) {
|
||||
return new TestHalJsonMvcEndpoint(managementServletContext);
|
||||
}
|
||||
|
||||
|
@ -111,13 +111,15 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
public void envMvcEndpointIsConditionalOnMissingBean() throws Exception {
|
||||
this.context.register(EnvConfiguration.class, TestEndpointConfiguration.class);
|
||||
this.context.refresh();
|
||||
EnvironmentMvcEndpoint mvcEndpoint = this.context.getBean(EnvironmentMvcEndpoint.class);
|
||||
EnvironmentMvcEndpoint mvcEndpoint = this.context
|
||||
.getBean(EnvironmentMvcEndpoint.class);
|
||||
assertThat(mvcEndpoint).isInstanceOf(TestEnvMvcEndpoint.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metricsMvcEndpointIsConditionalOnMissingBean() throws Exception {
|
||||
this.context.register(MetricsConfiguration.class, TestEndpointConfiguration.class);
|
||||
this.context.register(MetricsConfiguration.class,
|
||||
TestEndpointConfiguration.class);
|
||||
this.context.refresh();
|
||||
MetricsMvcEndpoint mvcEndpoint = this.context.getBean(MetricsMvcEndpoint.class);
|
||||
assertThat(mvcEndpoint).isInstanceOf(TestMetricsMvcEndpoint.class);
|
||||
@ -125,7 +127,8 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void logFileMvcEndpointIsConditionalOnMissingBean() throws Exception {
|
||||
this.context.register(LogFileConfiguration.class, TestEndpointConfiguration.class);
|
||||
this.context.register(LogFileConfiguration.class,
|
||||
TestEndpointConfiguration.class);
|
||||
this.context.refresh();
|
||||
LogFileMvcEndpoint mvcEndpoint = this.context.getBean(LogFileMvcEndpoint.class);
|
||||
assertThat(mvcEndpoint).isInstanceOf(TestLogFileMvcEndpoint.class);
|
||||
@ -133,7 +136,8 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void shutdownEndpointIsConditionalOnMissingBean() throws Exception {
|
||||
this.context.register(ShutdownConfiguration.class, TestEndpointConfiguration.class);
|
||||
this.context.register(ShutdownConfiguration.class,
|
||||
TestEndpointConfiguration.class);
|
||||
this.context.refresh();
|
||||
ShutdownMvcEndpoint mvcEndpoint = this.context.getBean(ShutdownMvcEndpoint.class);
|
||||
assertThat(mvcEndpoint).isInstanceOf(TestShutdownMvcEndpoint.class);
|
||||
@ -141,15 +145,18 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void auditEventsMvcEndpointIsConditionalOnMissingBean() throws Exception {
|
||||
this.context.register(AuditEventsConfiguration.class, TestEndpointConfiguration.class);
|
||||
this.context.register(AuditEventsConfiguration.class,
|
||||
TestEndpointConfiguration.class);
|
||||
this.context.refresh();
|
||||
AuditEventsMvcEndpoint mvcEndpoint = this.context.getBean(AuditEventsMvcEndpoint.class);
|
||||
AuditEventsMvcEndpoint mvcEndpoint = this.context
|
||||
.getBean(AuditEventsMvcEndpoint.class);
|
||||
assertThat(mvcEndpoint).isInstanceOf(TestAuditEventsMvcEndpoint.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loggersMvcEndpointIsConditionalOnMissingBean() throws Exception {
|
||||
this.context.register(LoggersConfiguration.class, TestEndpointConfiguration.class);
|
||||
this.context.register(LoggersConfiguration.class,
|
||||
TestEndpointConfiguration.class);
|
||||
this.context.refresh();
|
||||
LoggersMvcEndpoint mvcEndpoint = this.context.getBean(LoggersMvcEndpoint.class);
|
||||
assertThat(mvcEndpoint).isInstanceOf(TestLoggersMvcEndpoint.class);
|
||||
@ -157,7 +164,8 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void heapdumpMvcEndpointIsConditionalOnMissingBean() throws Exception {
|
||||
this.context.register(HeapdumpConfiguration.class, TestEndpointConfiguration.class);
|
||||
this.context.register(HeapdumpConfiguration.class,
|
||||
TestEndpointConfiguration.class);
|
||||
this.context.refresh();
|
||||
HeapdumpMvcEndpoint mvcEndpoint = this.context.getBean(HeapdumpMvcEndpoint.class);
|
||||
assertThat(mvcEndpoint).isInstanceOf(TestHeapdumpMvcEndpoint.class);
|
||||
@ -171,11 +179,10 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
@Configuration
|
||||
@ImportAutoConfiguration({ SecurityAutoConfiguration.class,
|
||||
WebMvcAutoConfiguration.class, JacksonAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class,
|
||||
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class,
|
||||
EndpointWebMvcAutoConfiguration.class,
|
||||
ManagementServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class,
|
||||
WebClientAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class, WebClientAutoConfiguration.class,
|
||||
EndpointWebMvcManagementContextConfiguration.class })
|
||||
static class TestEndpointConfiguration {
|
||||
|
||||
@ -194,7 +201,8 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
static class EnvConfiguration {
|
||||
|
||||
@Bean
|
||||
public EnvironmentMvcEndpoint testEnvironmentMvcEndpoint(EnvironmentEndpoint endpoint) {
|
||||
public EnvironmentMvcEndpoint testEnvironmentMvcEndpoint(
|
||||
EnvironmentEndpoint endpoint) {
|
||||
return new TestEnvMvcEndpoint(endpoint);
|
||||
}
|
||||
|
||||
@ -245,7 +253,8 @@ public class EndpointWebMvcManagementContextConfigurationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuditEventsMvcEndpoint testAuditEventsMvcEndpoint(AuditEventRepository repository) {
|
||||
public AuditEventsMvcEndpoint testAuditEventsMvcEndpoint(
|
||||
AuditEventRepository repository) {
|
||||
return new TestAuditEventsMvcEndpoint(repository);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public enum EmbeddedDatabaseConnection {
|
||||
*/
|
||||
public String getUrl(String databaseName) {
|
||||
Assert.hasText(databaseName, "DatabaseName must not be null.");
|
||||
return this.url != null ? String.format(this.url, databaseName) : null;
|
||||
return (this.url != null ? String.format(this.url, databaseName) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ public class ElasticsearchDataAutoConfigurationTests {
|
||||
"spring.data.elasticsearch.properties.path.logs:target/logs");
|
||||
assertThat(
|
||||
this.context.getBeanNamesForType(SimpleElasticsearchMappingContext.class))
|
||||
.hasSize(1);
|
||||
.hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -80,13 +80,13 @@ public class ElasticsearchDataAutoConfigurationTests {
|
||||
}
|
||||
|
||||
private void load(String... environment) {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(ctx, environment);
|
||||
ctx.register(PropertyPlaceholderAutoConfiguration.class,
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(context, environment);
|
||||
context.register(PropertyPlaceholderAutoConfiguration.class,
|
||||
ElasticsearchAutoConfiguration.class,
|
||||
ElasticsearchDataAutoConfiguration.class);
|
||||
ctx.refresh();
|
||||
this.context = ctx;
|
||||
context.refresh();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ public class DataSourcePropertiesTests {
|
||||
@Test
|
||||
public void determineUrlWithNoEmbeddedSupport() throws Exception {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
properties.setBeanClassLoader(new HidePackagesClassLoader("org.h2",
|
||||
"org.apache.derby", "org.hsqldb"));
|
||||
properties.setBeanClassLoader(
|
||||
new HidePackagesClassLoader("org.h2", "org.apache.derby", "org.hsqldb"));
|
||||
properties.afterPropertiesSet();
|
||||
this.thrown.expect(DataSourceProperties.DataSourceBeanCreationException.class);
|
||||
this.thrown.expectMessage("Cannot determine embedded database url");
|
||||
|
@ -3027,4 +3027,4 @@
|
||||
<id>integration-test</id>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
</project>
|
||||
|
@ -55,7 +55,6 @@ public final class JsonContent<T> implements AssertProvider<JsonContentAssert> {
|
||||
/**
|
||||
* Use AssertJ's {@link org.assertj.core.api.Assertions#assertThat assertThat}
|
||||
* instead.
|
||||
*
|
||||
* @deprecated in favor of AssertJ's {@link org.assertj.core.api.Assertions#assertThat
|
||||
* assertThat}
|
||||
*/
|
||||
|
@ -177,7 +177,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object processValue(Object value) {
|
||||
private Object processValue(Object value) {
|
||||
if (value instanceof DeclaredType) {
|
||||
return getQualifiedName(((DeclaredType) value).asElement());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user