mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '1.4.x' into 1.5.x
This commit is contained in:
commit
cdd59707fc
@ -224,16 +224,16 @@ public class DataSourceAutoConfiguration {
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
ConditionMessage.Builder message = ConditionMessage
|
||||
.forCondition("EmbeddedDataAvailable");
|
||||
.forCondition("DataSourceAvailable");
|
||||
if (hasBean(context, DataSource.class)
|
||||
|| hasBean(context, XADataSource.class)) {
|
||||
return ConditionOutcome
|
||||
.match(message.foundExactly("existing database bean"));
|
||||
.match(message.foundExactly("existing data source bean"));
|
||||
}
|
||||
if (anyMatches(context, metadata, this.pooledCondition,
|
||||
this.embeddedCondition)) {
|
||||
return ConditionOutcome
|
||||
.match(message.foundExactly("existing auto-configured database"));
|
||||
.match(message.foundExactly("existing auto-configured data source bean"));
|
||||
}
|
||||
return ConditionOutcome
|
||||
.noMatch(message.didNotFind("any existing data source bean").atAll());
|
||||
|
@ -127,7 +127,7 @@ public class OAuth2ResourceServerConfiguration {
|
||||
}
|
||||
if (StringUtils.hasText(resolver.getProperty("user-info-uri"))) {
|
||||
return ConditionOutcome
|
||||
.match(message.foundExactly("user-info-url property"));
|
||||
.match(message.foundExactly("user-info-uri property"));
|
||||
}
|
||||
if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
|
||||
if (AuthorizationServerEndpointsConfigurationBeanCondition
|
||||
|
@ -36,7 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
class OnEnabledResourceChainCondition extends SpringBootCondition {
|
||||
|
||||
private static final String WEBJAR_ASSERT_LOCATOR = "org.webjars.WebJarAssetLocator";
|
||||
private static final String WEBJAR_ASSET_LOCATOR = "org.webjars.WebJarAssetLocator";
|
||||
|
||||
@Override
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
@ -50,13 +50,13 @@ class OnEnabledResourceChainCondition extends SpringBootCondition {
|
||||
ConditionMessage.Builder message = ConditionMessage
|
||||
.forCondition(ConditionalOnEnabledResourceChain.class);
|
||||
if (match == null) {
|
||||
if (ClassUtils.isPresent(WEBJAR_ASSERT_LOCATOR,
|
||||
if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR,
|
||||
getClass().getClassLoader())) {
|
||||
return ConditionOutcome
|
||||
.match(message.found("class").items(WEBJAR_ASSERT_LOCATOR));
|
||||
.match(message.found("class").items(WEBJAR_ASSET_LOCATOR));
|
||||
}
|
||||
return ConditionOutcome
|
||||
.noMatch(message.didNotFind("class").items(WEBJAR_ASSERT_LOCATOR));
|
||||
.noMatch(message.didNotFind("class").items(WEBJAR_ASSET_LOCATOR));
|
||||
}
|
||||
if (match) {
|
||||
return ConditionOutcome.match(message.because("enabled"));
|
||||
|
@ -45,13 +45,13 @@ public class ConditionMessageTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toStringWhenHasMessageShouldReturnMessage() throws Exception {
|
||||
public void toStringWhenEmptyShouldReturnEmptyString() throws Exception {
|
||||
ConditionMessage message = ConditionMessage.empty();
|
||||
assertThat(message.toString()).isEqualTo("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toStringWhenEmptyShouldReturnEmptyString() throws Exception {
|
||||
public void toStringWhenHasMessageShouldReturnMessage() throws Exception {
|
||||
ConditionMessage message = ConditionMessage.of("Test");
|
||||
assertThat(message.toString()).isEqualTo("Test");
|
||||
}
|
||||
|
@ -21,9 +21,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
@ -47,9 +45,6 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class QualifierDefinitionTests {
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Mock
|
||||
private ConfigurableListableBeanFactory beanFactory;
|
||||
|
||||
|
@ -2,5 +2,5 @@ import static org.junit.Assert.assertTrue
|
||||
|
||||
def file = new File(basedir, "build.log")
|
||||
assertTrue 'Devtools should have been detected', file.text.contains('Fork mode disabled, devtools will be disabled')
|
||||
assertTrue 'Application should have ran', file.text.contains("I haz been run")
|
||||
assertTrue 'Application should have run', file.text.contains("I haz been run")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user