diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index 3a35ad4000..c6a12bf36d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -141,7 +141,7 @@ public final class ConditionMessage { /** * Factory method to create a new {@link ConditionMessage} with a specific message. * @param message the source message (may be a format string if {@code args} are - * specified + * specified) * @param args format arguments for the message * @return a new {@link ConditionMessage} instance */ @@ -155,7 +155,7 @@ public final class ConditionMessage { /** * Factory method to create a new {@link ConditionMessage} comprised of the specified * messages. - * @param messages the source messages (may be {@code null} + * @param messages the source messages (may be {@code null}) * @return a new {@link ConditionMessage} instance */ public static ConditionMessage of(Collection messages) { @@ -283,7 +283,7 @@ public final class ConditionMessage { /** * Indicates something is not available. For example {@code notAvailable("time")} - * results in the message "time in not available". + * results in the message "time is not available". * @param item the item that is not available * @return a built {@link ConditionMessage} */ @@ -374,9 +374,9 @@ public final class ConditionMessage { } /** - * Indicate the items. For example - * {@code didNotFind("bean", "beans").items(Collections.singleton("x")} results in - * the message "did not find bean x". + * Indicate the items with a {@link Style}. For example + * {@code didNotFind("bean", "beans").items(Style.QUOTE, Collections.singleton("x")} results in + * the message "did not find bean 'x'". * @param style the render style * @param items the source of the items (may be {@code null}) * @return a built {@link ConditionMessage} diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java index 7155b6fde2..d90669143b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java @@ -132,7 +132,7 @@ public class ConditionMessageTests { } @Test - public void foundWhenSingleElementShouldUsingSingular() throws Exception { + public void foundWhenSingleElementShouldUseSingular() throws Exception { ConditionMessage message = ConditionMessage.forCondition(Test.class) .found("bean", "beans").items("a"); assertThat(message.toString()).isEqualTo("@Test found bean a"); @@ -160,7 +160,7 @@ public class ConditionMessageTests { } @Test - public void didNotFindWhenSingleElementShouldUsingSingular() throws Exception { + public void didNotFindWhenSingleElementShouldUseSingular() throws Exception { ConditionMessage message = ConditionMessage.forCondition(Test.class) .didNotFind("class", "classes").items("a"); assertThat(message.toString()).isEqualTo("@Test did not find class a"); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/OnInitializedRestarterCondition.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/OnInitializedRestarterCondition.java index 2ef5097c6e..deada57f98 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/OnInitializedRestarterCondition.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/OnInitializedRestarterCondition.java @@ -24,7 +24,7 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; /** - * {@link Condition} that checks that a {@link Restarter} is available an initialized. + * {@link Condition} that checks that a {@link Restarter} is available and initialized. * * @author Phillip Webb * @see ConditionalOnInitializedRestarter @@ -35,7 +35,7 @@ class OnInitializedRestarterCondition extends SpringBootCondition { public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage - .forCondition("Initializer Restarter Condition"); + .forCondition("Initialized Restarter Condition"); Restarter restarter = getRestarter(); if (restarter == null) { return ConditionOutcome.noMatch(message.because("unavailable")); diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index 1340d6d48b..07c3cbdee5 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -24,9 +24,9 @@ can send us a {github-code}[pull request]. [[howto-failure-analyzer]] === Create your own FailureAnalyzer -{dc-spring-boot}/diagnostics/FailureAnalyzer.{dc-ext}[[`FailureAnalyzer`] is a great way +{dc-spring-boot}/diagnostics/FailureAnalyzer.{dc-ext}[`FailureAnalyzer`] is a great way to intercept an exception on startup and turn it into a human-readable message, wrapped -into a {dc-spring-boot}/diagnostics/FailureAnalysis.{dc-ext}[[`FailureAnalysis`]. Spring +into a {dc-spring-boot}/diagnostics/FailureAnalysis.{dc-ext}[`FailureAnalysis`]. Spring Boot provides such analyzer for application context related exceptions, JSR-303 validations and more. It is actually very easy to create your own. @@ -34,7 +34,7 @@ validations and more. It is actually very easy to create your own. presence of a specified exception type in the exception to handle. You can extend from that so that your implementation gets a chance to handle the exception only when it is actually present. If for whatever reason you can't handle the exception, return `null` -to let another implementation a chance to handle the exception. +to give another implementation a chance to handle the exception. `FailureAnalyzer` implementations are to be registered in a `META-INF/spring.factories`: the following registers `ProjectConstraintViolationFailureAnalyzer`: @@ -2652,7 +2652,7 @@ then be depended upon by your application and other projects. If you cannot rearrange your code as recommended above, Spring Boot's Maven and Gradle plugins must be configured to produce a separate artifact that is suitable for use as a dependency. The executable archive cannot be used as a dependency as the -<> packages application classes in `BOOT-INF/classes`. This means that they cannot be found when the executable jar is used as a dependency. diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index c9868670df..23c809eb6f 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -5266,7 +5266,7 @@ Data JPA tests may also inject a bean which provides an alternative to the standard JPA `EntityManager` specifically designed for tests. If you want to use `TestEntityManager` outside of `@DataJpaTests` you can also use the `@AutoConfigureTestEntityManager` annotation. A `JdbcTemplate` is also -available should you need that. +available if you need that. [source,java,indent=0] ---- diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java index 8fec4c6093..dfe2304fdf 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java @@ -24,7 +24,6 @@ import org.springframework.boot.test.context.SpringBootTestContextBootstrapper; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Component; import org.springframework.test.context.BootstrapWith; import org.springframework.test.context.junit4.SpringRunner; @@ -83,9 +82,4 @@ public class SpringBootTestContextBootstrapperIntegrationTests { } - @Component - static class ExampleTestComponent { - - } - } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java index b4aa87be24..65ac8cf512 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java @@ -169,6 +169,8 @@ public class DefinitionsParserTests { QualifierDefinition qualifier = QualifierDefinition.forElement( ReflectionUtils.findField(SpyBeanOnClassAndField.class, "caller")); assertThat(fieldDefinition.getQualifier()).isNotNull().isEqualTo(qualifier); + assertThat(fieldDefinition.getTypeToSpy().resolve()) + .isEqualTo(ExampleServiceCaller.class); } @Test diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java index a834a32bc2..6d51fa460d 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java @@ -36,6 +36,9 @@ import static org.mockito.Mockito.verify; /** * Test {@link MockBean} on a test class field can be used to replace existing bean while * preserving qualifiers. + * + * @author Stephane Nicoll + * @author Phillip Webb */ @RunWith(SpringRunner.class) public class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/CustomQualifier.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/CustomQualifier.java index 89fbd166cd..a32b8e4c5c 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/CustomQualifier.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/CustomQualifier.java @@ -21,6 +21,11 @@ import java.lang.annotation.RetentionPolicy; import org.springframework.beans.factory.annotation.Qualifier; +/** + * Custom qualifier for testing. + * + * @author Stephane Nicoll + */ @Qualifier @Retention(RetentionPolicy.RUNTIME) public @interface CustomQualifier { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/MyMockBean.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/MyMockBean.java deleted file mode 100644 index d9d63692f0..0000000000 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/MyMockBean.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.test.mock.mockito.example; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.core.annotation.AliasFor; - -@Target({ ElementType.TYPE, ElementType.FIELD }) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@MockBean -public @interface MyMockBean { - - @AliasFor(annotation = MockBean.class, attribute = "value") - Class value(); - -} diff --git a/spring-boot/src/main/java/org/springframework/boot/jackson/JsonObjectDeserializer.java b/spring-boot/src/main/java/org/springframework/boot/jackson/JsonObjectDeserializer.java index a0b638502c..65904a12ee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jackson/JsonObjectDeserializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/jackson/JsonObjectDeserializer.java @@ -78,7 +78,7 @@ public abstract class JsonObjectDeserializer /** * Helper method to extract a value from the given {@code jsonNode} or return * {@code null} when the node itself is {@code null}. - * @param jsonNode the source node (may be {@code null} + * @param jsonNode the source node (may be {@code null}) * @param type the data type. May be {@link String}, {@link Boolean}, {@link Long}, * {@link Integer}, {@link Short}, {@link Double}, {@link Float}, {@link BigDecimal} * or {@link BigInteger}.