File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2012-2016 the original author or authors.
2
+ * Copyright 2012-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
37
37
* or test classes that are {@link RunWith @RunWith} the {@link SpringRunner}.
38
38
* <p>
39
39
* Mocks can be registered by type or by {@link #name() bean name}. Any existing single
40
- * bean of the same type defined in the context will be replaced by the mock, if no
41
- * existing bean is defined a new one will be added.
40
+ * bean of the same type defined in the context will be replaced by the mock. If no
41
+ * existing bean is defined a new one will be added. Dependencies that are known to the
42
+ * application context but are not beans (such as those
43
+ * {@link org.springframework.beans.factory.config.ConfigurableListableBeanFactory#registerResolvableDependency(Class, Object)
44
+ * registered directly} ) will not be found and a mocked bean will be added to the context
45
+ * alongside the existing dependency.
42
46
* <p>
43
47
* When {@code @MockBean} is used on a field, as well as being registered in the
44
48
* application context, the mock will also be injected into the field. Typical usage might
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2012-2016 the original author or authors.
2
+ * Copyright 2012-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
38
38
* <p>
39
39
* Spies can be applied by type or by {@link #name() bean name}. All beans in the context
40
40
* of the same type will be wrapped with the spy. If no existing bean is defined a new one
41
- * will be added.
41
+ * will be added. Dependencies that are known to the application context but are not beans
42
+ * (such as those
43
+ * {@link org.springframework.beans.factory.config.ConfigurableListableBeanFactory#registerResolvableDependency(Class, Object)
44
+ * registered directly} ) will not be found and a spied bean will be added to the context
45
+ * alongside the existing dependency.
42
46
* <p>
43
47
* When {@code @SpyBean} is used on a field, as well as being registered in the
44
48
* application context, the spy will also be injected into the field. Typical usage might
You can’t perform that action at this time.
0 commit comments