Formatting
This commit is contained in:
parent
39ed0d4dfb
commit
3326841a97
|
@ -183,14 +183,15 @@ public class EndpointWebMvcManagementContextConfiguration {
|
||||||
AnnotatedTypeMetadata metadata) {
|
AnnotatedTypeMetadata metadata) {
|
||||||
Environment environment = context.getEnvironment();
|
Environment environment = context.getEnvironment();
|
||||||
String config = environment.resolvePlaceholders("${logging.file:}");
|
String config = environment.resolvePlaceholders("${logging.file:}");
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage.forCondition("Log File");
|
||||||
.forCondition("Log File");
|
|
||||||
if (StringUtils.hasText(config)) {
|
if (StringUtils.hasText(config)) {
|
||||||
return ConditionOutcome.match(message.found("logging.file").items(config));
|
return ConditionOutcome
|
||||||
|
.match(message.found("logging.file").items(config));
|
||||||
}
|
}
|
||||||
config = environment.resolvePlaceholders("${logging.path:}");
|
config = environment.resolvePlaceholders("${logging.path:}");
|
||||||
if (StringUtils.hasText(config)) {
|
if (StringUtils.hasText(config)) {
|
||||||
return ConditionOutcome.match(message.found("logging.path").items(config));
|
return ConditionOutcome
|
||||||
|
.match(message.found("logging.path").items(config));
|
||||||
}
|
}
|
||||||
config = new RelaxedPropertyResolver(environment, "endpoints.logfile.")
|
config = new RelaxedPropertyResolver(environment, "endpoints.logfile.")
|
||||||
.getProperty("external-file");
|
.getProperty("external-file");
|
||||||
|
|
|
@ -98,7 +98,8 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||||
MongoDataAutoConfiguration.class, RabbitAutoConfiguration.class,
|
MongoDataAutoConfiguration.class, RabbitAutoConfiguration.class,
|
||||||
RedisAutoConfiguration.class, SolrAutoConfiguration.class })
|
RedisAutoConfiguration.class, SolrAutoConfiguration.class })
|
||||||
@EnableConfigurationProperties({ HealthIndicatorProperties.class })
|
@EnableConfigurationProperties({ HealthIndicatorProperties.class })
|
||||||
@Import({ ElasticsearchHealthIndicatorConfiguration.ElasticsearchClientHealthIndicatorConfiguration.class,
|
@Import({
|
||||||
|
ElasticsearchHealthIndicatorConfiguration.ElasticsearchClientHealthIndicatorConfiguration.class,
|
||||||
ElasticsearchHealthIndicatorConfiguration.ElasticsearchJestHealthIndicatorConfiguration.class })
|
ElasticsearchHealthIndicatorConfiguration.ElasticsearchJestHealthIndicatorConfiguration.class })
|
||||||
public class HealthIndicatorAutoConfiguration {
|
public class HealthIndicatorAutoConfiguration {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ public class InfoContributorProperties {
|
||||||
return this.git;
|
return this.git;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Git {
|
public static class Git {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -98,8 +98,7 @@ public class JolokiaAutoConfiguration {
|
||||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||||
AnnotatedTypeMetadata metadata) {
|
AnnotatedTypeMetadata metadata) {
|
||||||
boolean endpointsEnabled = isEnabled(context, "endpoints.", true);
|
boolean endpointsEnabled = isEnabled(context, "endpoints.", true);
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage.forCondition("Jolokia");
|
||||||
.forCondition("Jolokia");
|
|
||||||
if (isEnabled(context, "endpoints.jolokia.", endpointsEnabled)) {
|
if (isEnabled(context, "endpoints.jolokia.", endpointsEnabled)) {
|
||||||
return ConditionOutcome.match(message.because("enabled"));
|
return ConditionOutcome.match(message.because("enabled"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,9 +398,9 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||||
EnvironmentTestUtils.addEnvironment(this.context,
|
EnvironmentTestUtils.addEnvironment(this.context,
|
||||||
"spring.data.elasticsearch.properties.path.home:target",
|
"spring.data.elasticsearch.properties.path.home:target",
|
||||||
"management.health.diskspace.enabled:false");
|
"management.health.diskspace.enabled:false");
|
||||||
this.context.register(JestClientConfiguration.class,
|
this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
|
||||||
JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class,
|
ElasticsearchAutoConfiguration.class, ManagementServerProperties.class,
|
||||||
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
|
HealthIndicatorAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
|
|
||||||
Map<String, HealthIndicator> beans = this.context
|
Map<String, HealthIndicator> beans = this.context
|
||||||
|
@ -414,9 +414,8 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||||
public void elasticsearchJestHealthIndicator() {
|
public void elasticsearchJestHealthIndicator() {
|
||||||
EnvironmentTestUtils.addEnvironment(this.context,
|
EnvironmentTestUtils.addEnvironment(this.context,
|
||||||
"management.health.diskspace.enabled:false");
|
"management.health.diskspace.enabled:false");
|
||||||
this.context.register(JestClientConfiguration.class,
|
this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
|
||||||
JestAutoConfiguration.class, ManagementServerProperties.class,
|
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
|
||||||
HealthIndicatorAutoConfiguration.class);
|
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
|
|
||||||
Map<String, HealthIndicator> beans = this.context
|
Map<String, HealthIndicator> beans = this.context
|
||||||
|
@ -432,9 +431,9 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||||
"management.health.elasticsearch.enabled:false",
|
"management.health.elasticsearch.enabled:false",
|
||||||
"spring.data.elasticsearch.properties.path.home:target",
|
"spring.data.elasticsearch.properties.path.home:target",
|
||||||
"management.health.diskspace.enabled:false");
|
"management.health.diskspace.enabled:false");
|
||||||
this.context.register(JestClientConfiguration.class,
|
this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
|
||||||
JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class,
|
ElasticsearchAutoConfiguration.class, ManagementServerProperties.class,
|
||||||
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
|
HealthIndicatorAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
|
|
||||||
Map<String, HealthIndicator> beans = this.context
|
Map<String, HealthIndicator> beans = this.context
|
||||||
|
|
|
@ -73,8 +73,8 @@ public class AuthorizationAuditListenerTests {
|
||||||
@Test
|
@Test
|
||||||
public void testDetailsAreIncludedInAuditEvent() throws Exception {
|
public void testDetailsAreIncludedInAuditEvent() throws Exception {
|
||||||
Object details = new Object();
|
Object details = new Object();
|
||||||
UsernamePasswordAuthenticationToken authentication =
|
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
|
||||||
new UsernamePasswordAuthenticationToken("user", "password");
|
"user", "password");
|
||||||
authentication.setDetails(details);
|
authentication.setDetails(details);
|
||||||
this.listener.onApplicationEvent(new AuthorizationFailureEvent(this,
|
this.listener.onApplicationEvent(new AuthorizationFailureEvent(this,
|
||||||
Arrays.<ConfigAttribute>asList(new SecurityConfig("USER")),
|
Arrays.<ConfigAttribute>asList(new SecurityConfig("USER")),
|
||||||
|
|
|
@ -178,8 +178,7 @@ class JCacheCacheConfiguration {
|
||||||
@Override
|
@Override
|
||||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||||
AnnotatedTypeMetadata metadata) {
|
AnnotatedTypeMetadata metadata) {
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage.forCondition("JCache");
|
||||||
.forCondition("JCache");
|
|
||||||
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
|
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
|
||||||
context.getEnvironment(), "spring.cache.jcache.");
|
context.getEnvironment(), "spring.cache.jcache.");
|
||||||
if (resolver.containsProperty("provider")) {
|
if (resolver.containsProperty("provider")) {
|
||||||
|
|
|
@ -375,8 +375,8 @@ public final class ConditionMessage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate the items with a {@link Style}. For example
|
* Indicate the items with a {@link Style}. For example
|
||||||
* {@code didNotFind("bean", "beans").items(Style.QUOTE, Collections.singleton("x")} results in
|
* {@code didNotFind("bean", "beans").items(Style.QUOTE, Collections.singleton("x")}
|
||||||
* the message "did not find bean 'x'".
|
* results in the message "did not find bean 'x'".
|
||||||
* @param style the render style
|
* @param style the render style
|
||||||
* @param items the source of the items (may be {@code null})
|
* @param items the source of the items (may be {@code null})
|
||||||
* @return a built {@link ConditionMessage}
|
* @return a built {@link ConditionMessage}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapt
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@code RepositoryRestConfigurer} that applies configuration items from
|
* A {@code RepositoryRestConfigurer} that applies configuration items from the
|
||||||
* the {@code spring.data.rest} namespace to Spring Data REST. Also, if a
|
* {@code spring.data.rest} namespace to Spring Data REST. Also, if a
|
||||||
* {@link Jackson2ObjectMapperBuilder} is available, it is used to configure Spring Data
|
* {@link Jackson2ObjectMapperBuilder} is available, it is used to configure Spring Data
|
||||||
* REST's {@link ObjectMapper ObjectMappers}.
|
* REST's {@link ObjectMapper ObjectMappers}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -108,7 +108,8 @@ public class ProjectInfoAutoConfiguration {
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage
|
||||||
.forCondition("GitResource");
|
.forCondition("GitResource");
|
||||||
if (loader.getResource(location).exists()) {
|
if (loader.getResource(location).exists()) {
|
||||||
return ConditionOutcome.match(message.found("git info at").items(location));
|
return ConditionOutcome
|
||||||
|
.match(message.found("git info at").items(location));
|
||||||
}
|
}
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.noMatch(message.didNotFind("git info at").items(location));
|
.noMatch(message.didNotFind("git info at").items(location));
|
||||||
|
|
|
@ -232,8 +232,8 @@ public class DataSourceAutoConfiguration {
|
||||||
}
|
}
|
||||||
if (anyMatches(context, metadata, this.pooledCondition,
|
if (anyMatches(context, metadata, this.pooledCondition,
|
||||||
this.embeddedCondition)) {
|
this.embeddedCondition)) {
|
||||||
return ConditionOutcome
|
return ConditionOutcome.match(message
|
||||||
.match(message.foundExactly("existing auto-configured data source bean"));
|
.foundExactly("existing auto-configured data source bean"));
|
||||||
}
|
}
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.noMatch(message.didNotFind("any existing data source bean").atAll());
|
.noMatch(message.didNotFind("any existing data source bean").atAll());
|
||||||
|
|
|
@ -132,8 +132,8 @@ public class OAuth2ResourceServerConfiguration {
|
||||||
if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
|
if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
|
||||||
if (AuthorizationServerEndpointsConfigurationBeanCondition
|
if (AuthorizationServerEndpointsConfigurationBeanCondition
|
||||||
.matches(context)) {
|
.matches(context)) {
|
||||||
return ConditionOutcome
|
return ConditionOutcome.match(
|
||||||
.match(message.found("class").items(AUTHORIZATION_ANNOTATION));
|
message.found("class").items(AUTHORIZATION_ANNOTATION));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ConditionOutcome.noMatch(
|
return ConditionOutcome.noMatch(
|
||||||
|
|
|
@ -58,8 +58,8 @@ class SessionCondition extends SpringBootCondition {
|
||||||
return ConditionOutcome.match(message
|
return ConditionOutcome.match(message
|
||||||
.found("spring.session.store-type property").items(sessionStoreType));
|
.found("spring.session.store-type property").items(sessionStoreType));
|
||||||
}
|
}
|
||||||
return ConditionOutcome
|
return ConditionOutcome.noMatch(
|
||||||
.noMatch(message.found("spring.session.store-type property").items(value));
|
message.found("spring.session.store-type property").items(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,7 @@ class OnEnabledResourceChainCondition extends SpringBootCondition {
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage
|
||||||
.forCondition(ConditionalOnEnabledResourceChain.class);
|
.forCondition(ConditionalOnEnabledResourceChain.class);
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR,
|
if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR, getClass().getClassLoader())) {
|
||||||
getClass().getClassLoader())) {
|
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.match(message.found("class").items(WEBJAR_ASSET_LOCATOR));
|
.match(message.found("class").items(WEBJAR_ASSET_LOCATOR));
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,9 @@ public class BatchAutoConfigurationTests {
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
||||||
assertThat(this.context.getBean(JobExplorer.class)).isNotNull();
|
assertThat(this.context.getBean(JobExplorer.class)).isNotNull();
|
||||||
assertThat(this.context.getBean(BatchProperties.class)
|
assertThat(
|
||||||
.getInitializer().isEnabled()).isTrue();
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
||||||
|
.isTrue();
|
||||||
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
|
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
|
||||||
.queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty();
|
.queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -193,8 +194,9 @@ public class BatchAutoConfigurationTests {
|
||||||
PropertyPlaceholderAutoConfiguration.class);
|
PropertyPlaceholderAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
||||||
assertThat(this.context.getBean(BatchProperties.class)
|
assertThat(
|
||||||
.getInitializer().isEnabled()).isFalse();
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
||||||
|
.isFalse();
|
||||||
this.expected.expect(BadSqlGrammarException.class);
|
this.expected.expect(BadSqlGrammarException.class);
|
||||||
new JdbcTemplate(this.context.getBean(DataSource.class))
|
new JdbcTemplate(this.context.getBean(DataSource.class))
|
||||||
.queryForList("select * from BATCH_JOB_EXECUTION");
|
.queryForList("select * from BATCH_JOB_EXECUTION");
|
||||||
|
@ -233,8 +235,9 @@ public class BatchAutoConfigurationTests {
|
||||||
PropertyPlaceholderAutoConfiguration.class);
|
PropertyPlaceholderAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
||||||
assertThat(this.context.getBean(BatchProperties.class)
|
assertThat(
|
||||||
.getInitializer().isEnabled()).isTrue();
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
||||||
|
.isTrue();
|
||||||
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
|
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
|
||||||
.queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty();
|
.queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty();
|
||||||
JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
|
JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
|
||||||
|
@ -245,19 +248,20 @@ public class BatchAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomTablePrefixWithDefaultSchemaDisablesInitializer() throws Exception {
|
public void testCustomTablePrefixWithDefaultSchemaDisablesInitializer()
|
||||||
|
throws Exception {
|
||||||
this.context = new AnnotationConfigApplicationContext();
|
this.context = new AnnotationConfigApplicationContext();
|
||||||
EnvironmentTestUtils.addEnvironment(this.context,
|
EnvironmentTestUtils.addEnvironment(this.context,
|
||||||
"spring.datasource.name:batchtest",
|
"spring.datasource.name:batchtest", "spring.batch.tablePrefix:PREFIX_");
|
||||||
"spring.batch.tablePrefix:PREFIX_");
|
|
||||||
this.context.register(TestConfiguration.class,
|
this.context.register(TestConfiguration.class,
|
||||||
EmbeddedDataSourceConfiguration.class,
|
EmbeddedDataSourceConfiguration.class,
|
||||||
HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
|
HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
|
||||||
PropertyPlaceholderAutoConfiguration.class);
|
PropertyPlaceholderAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
||||||
assertThat(this.context.getBean(BatchProperties.class)
|
assertThat(
|
||||||
.getInitializer().isEnabled()).isFalse();
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
||||||
|
.isFalse();
|
||||||
this.expected.expect(BadSqlGrammarException.class);
|
this.expected.expect(BadSqlGrammarException.class);
|
||||||
new JdbcTemplate(this.context.getBean(DataSource.class))
|
new JdbcTemplate(this.context.getBean(DataSource.class))
|
||||||
.queryForList("select * from BATCH_JOB_EXECUTION");
|
.queryForList("select * from BATCH_JOB_EXECUTION");
|
||||||
|
|
|
@ -107,8 +107,8 @@ public class IntegrationAutoConfigurationTests {
|
||||||
public void primaryExporterIsAllowed() {
|
public void primaryExporterIsAllowed() {
|
||||||
load(CustomMBeanExporter.class);
|
load(CustomMBeanExporter.class);
|
||||||
assertThat(this.context.getBeansOfType(MBeanExporter.class)).hasSize(2);
|
assertThat(this.context.getBeansOfType(MBeanExporter.class)).hasSize(2);
|
||||||
assertThat(this.context.getBean(MBeanExporter.class)).isSameAs(
|
assertThat(this.context.getBean(MBeanExporter.class))
|
||||||
this.context.getBean("myMBeanExporter"));
|
.isSameAs(this.context.getBean("myMBeanExporter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertDomains(MBeanServer mBeanServer, boolean expected,
|
private static void assertDomains(MBeanServer mBeanServer, boolean expected,
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class SessionAutoConfigurationJdbcTests
|
||||||
JdbcOperationsSessionRepository.class);
|
JdbcOperationsSessionRepository.class);
|
||||||
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
||||||
.isEqualTo("SPRING_SESSION");
|
.isEqualTo("SPRING_SESSION");
|
||||||
assertThat(this.context.getBean(SessionProperties.class)
|
assertThat(this.context.getBean(SessionProperties.class).getJdbc()
|
||||||
.getJdbc().getInitializer().isEnabled()).isTrue();
|
.getInitializer().isEnabled()).isTrue();
|
||||||
assertThat(this.context.getBean(JdbcOperations.class)
|
assertThat(this.context.getBean(JdbcOperations.class)
|
||||||
.queryForList("select * from SPRING_SESSION")).isEmpty();
|
.queryForList("select * from SPRING_SESSION")).isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -70,8 +70,8 @@ public class SessionAutoConfigurationJdbcTests
|
||||||
JdbcOperationsSessionRepository.class);
|
JdbcOperationsSessionRepository.class);
|
||||||
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
||||||
.isEqualTo("SPRING_SESSION");
|
.isEqualTo("SPRING_SESSION");
|
||||||
assertThat(this.context.getBean(SessionProperties.class)
|
assertThat(this.context.getBean(SessionProperties.class).getJdbc()
|
||||||
.getJdbc().getInitializer().isEnabled()).isFalse();
|
.getInitializer().isEnabled()).isFalse();
|
||||||
this.thrown.expect(BadSqlGrammarException.class);
|
this.thrown.expect(BadSqlGrammarException.class);
|
||||||
assertThat(this.context.getBean(JdbcOperations.class)
|
assertThat(this.context.getBean(JdbcOperations.class)
|
||||||
.queryForList("select * from SPRING_SESSION")).isEmpty();
|
.queryForList("select * from SPRING_SESSION")).isEmpty();
|
||||||
|
@ -88,8 +88,8 @@ public class SessionAutoConfigurationJdbcTests
|
||||||
JdbcOperationsSessionRepository.class);
|
JdbcOperationsSessionRepository.class);
|
||||||
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
||||||
.isEqualTo("FOO_BAR");
|
.isEqualTo("FOO_BAR");
|
||||||
assertThat(this.context.getBean(SessionProperties.class)
|
assertThat(this.context.getBean(SessionProperties.class).getJdbc()
|
||||||
.getJdbc().getInitializer().isEnabled()).isTrue();
|
.getInitializer().isEnabled()).isTrue();
|
||||||
assertThat(this.context.getBean(JdbcOperations.class)
|
assertThat(this.context.getBean(JdbcOperations.class)
|
||||||
.queryForList("select * from FOO_BAR")).isEmpty();
|
.queryForList("select * from FOO_BAR")).isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -104,8 +104,8 @@ public class SessionAutoConfigurationJdbcTests
|
||||||
JdbcOperationsSessionRepository.class);
|
JdbcOperationsSessionRepository.class);
|
||||||
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
|
||||||
.isEqualTo("FOO_BAR");
|
.isEqualTo("FOO_BAR");
|
||||||
assertThat(this.context.getBean(SessionProperties.class)
|
assertThat(this.context.getBean(SessionProperties.class).getJdbc()
|
||||||
.getJdbc().getInitializer().isEnabled()).isFalse();
|
.getInitializer().isEnabled()).isFalse();
|
||||||
this.thrown.expect(BadSqlGrammarException.class);
|
this.thrown.expect(BadSqlGrammarException.class);
|
||||||
assertThat(this.context.getBean(JdbcOperations.class)
|
assertThat(this.context.getBean(JdbcOperations.class)
|
||||||
.queryForList("select * from SPRING_SESSION")).isEmpty();
|
.queryForList("select * from SPRING_SESSION")).isEmpty();
|
||||||
|
|
|
@ -50,7 +50,8 @@ public class SessionAutoConfigurationRedisTests
|
||||||
public void redisSessionStoreIsTheDefault() {
|
public void redisSessionStoreIsTheDefault() {
|
||||||
load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class));
|
load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class));
|
||||||
validateSpringSessionUsesRedis();
|
validateSpringSessionUsesRedis();
|
||||||
this.output.expect(containsString("Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration"));
|
this.output.expect(containsString(
|
||||||
|
"Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -58,7 +59,8 @@ public class SessionAutoConfigurationRedisTests
|
||||||
load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class),
|
load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class),
|
||||||
"spring.session.store-type=redis");
|
"spring.session.store-type=redis");
|
||||||
validateSpringSessionUsesRedis();
|
validateSpringSessionUsesRedis();
|
||||||
this.output.expect(not(containsString("Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration")));
|
this.output.expect(not(containsString(
|
||||||
|
"Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateSpringSessionUsesRedis() {
|
private void validateSpringSessionUsesRedis() {
|
||||||
|
|
|
@ -19,7 +19,8 @@ package org.springframework.boot.test.context.bootstrap;
|
||||||
import org.springframework.boot.SpringBootConfiguration;
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example configuration used in {@link SpringBootTestContextBootstrapperIntegrationTests}.
|
* Example configuration used in
|
||||||
|
* {@link SpringBootTestContextBootstrapperIntegrationTests}.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,9 +28,9 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link SpringApplicationRunListener} to publish {@link SpringApplicationEvent}s.
|
* {@link SpringApplicationRunListener} to publish {@link SpringApplicationEvent}s.
|
||||||
*
|
* <p>
|
||||||
* <p>Uses an internal {@link ApplicationEventMulticaster} for the events that are
|
* Uses an internal {@link ApplicationEventMulticaster} for the events that are fired
|
||||||
* fired before the context is actually refreshed.
|
* before the context is actually refreshed.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
@ -59,8 +59,8 @@ public class EventPublishingRunListener implements SpringApplicationRunListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void started() {
|
public void started() {
|
||||||
this.initialMulticaster.multicastEvent(new ApplicationStartedEvent(
|
this.initialMulticaster
|
||||||
this.application, this.args));
|
.multicastEvent(new ApplicationStartedEvent(this.application, this.args));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -82,8 +82,8 @@ public class EventPublishingRunListener implements SpringApplicationRunListener,
|
||||||
}
|
}
|
||||||
context.addApplicationListener(listener);
|
context.addApplicationListener(listener);
|
||||||
}
|
}
|
||||||
this.initialMulticaster.multicastEvent(new ApplicationPreparedEvent(
|
this.initialMulticaster.multicastEvent(
|
||||||
this.application, this.args, context));
|
new ApplicationPreparedEvent(this.application, this.args, context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,15 +23,15 @@ import org.springframework.core.env.Environment;
|
||||||
/**
|
/**
|
||||||
* Allows for customization of the application's {@link Environment} prior to the
|
* Allows for customization of the application's {@link Environment} prior to the
|
||||||
* application context being refreshed.
|
* application context being refreshed.
|
||||||
*
|
* <p>
|
||||||
* <p>EnvironmentPostProcessor implementations have to be registered in
|
* EnvironmentPostProcessor implementations have to be registered in
|
||||||
* {@code META-INF/spring.factories}, using the fully qualified name of this
|
* {@code META-INF/spring.factories}, using the fully qualified name of this class as the
|
||||||
* class as the key.
|
* key.
|
||||||
*
|
* <p>
|
||||||
* <p>{@code EnvironmentPostProcessor} processors are encouraged to detect
|
* {@code EnvironmentPostProcessor} processors are encouraged to detect whether Spring's
|
||||||
* whether Spring's {@link org.springframework.core.Ordered Ordered} interface has been
|
* {@link org.springframework.core.Ordered Ordered} interface has been implemented or if
|
||||||
* implemented or if the @{@link org.springframework.core.annotation.Order Order}
|
* the @{@link org.springframework.core.annotation.Order Order} annotation is present and
|
||||||
* annotation is present and to sort instances accordingly if so prior to invocation.
|
* to sort instances accordingly if so prior to invocation.
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
|
|
@ -67,7 +67,8 @@ public class SpringPhysicalNamingStrategy implements PhysicalNamingStrategy {
|
||||||
}
|
}
|
||||||
StringBuilder text = new StringBuilder(name.getText().replace('.', '_'));
|
StringBuilder text = new StringBuilder(name.getText().replace('.', '_'));
|
||||||
for (int i = 1; i < text.length() - 1; i++) {
|
for (int i = 1; i < text.length() - 1; i++) {
|
||||||
if (isUnderscoreRequired(text.charAt(i - 1), text.charAt(i), text.charAt(i + 1))) {
|
if (isUnderscoreRequired(text.charAt(i - 1), text.charAt(i),
|
||||||
|
text.charAt(i + 1))) {
|
||||||
text.insert(i++, '_');
|
text.insert(i++, '_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -826,8 +826,7 @@ public class ConfigFileApplicationListenerTests {
|
||||||
assertThat(environment.containsProperty("customprofile")).isTrue();
|
assertThat(environment.containsProperty("customprofile")).isTrue();
|
||||||
assertThat(environment.containsProperty("customprofile-specific")).isTrue();
|
assertThat(environment.containsProperty("customprofile-specific")).isTrue();
|
||||||
assertThat(environment.containsProperty("customprofile-customdefault")).isTrue();
|
assertThat(environment.containsProperty("customprofile-customdefault")).isTrue();
|
||||||
assertThat(environment.acceptsProfiles("customdefault"))
|
assertThat(environment.acceptsProfiles("customdefault")).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Condition<ConfigurableEnvironment> matchingPropertySource(
|
private Condition<ConfigurableEnvironment> matchingPropertySource(
|
||||||
|
|
Loading…
Reference in New Issue