|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2019 the original author or authors. |
| 2 | + * Copyright 2002-2020 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.
|
|
16 | 16 |
|
17 | 17 | package org.springframework.test.context.support;
|
18 | 18 |
|
| 19 | +import java.lang.annotation.ElementType; |
| 20 | +import java.lang.annotation.Retention; |
| 21 | +import java.lang.annotation.RetentionPolicy; |
| 22 | +import java.lang.annotation.Target; |
19 | 23 | import java.lang.reflect.Constructor;
|
20 | 24 |
|
21 | 25 | import org.junit.jupiter.api.AfterEach;
|
@@ -57,6 +61,11 @@ void testConstructorAnnotation() throws Exception {
|
57 | 61 | assertAutowirable(TestConstructorAnnotationTestCase.class);
|
58 | 62 | }
|
59 | 63 |
|
| 64 | + @Test |
| 65 | + void testConstructorAsMetaAnnotation() throws Exception { |
| 66 | + assertAutowirable(TestConstructorAsMetaAnnotationTestCase.class); |
| 67 | + } |
| 68 | + |
60 | 69 | @Test
|
61 | 70 | void automaticallyAutowired() throws Exception {
|
62 | 71 | setGlobalFlag();
|
@@ -125,6 +134,16 @@ static class AutowiredAnnotationTestCase {
|
125 | 134 | static class TestConstructorAnnotationTestCase {
|
126 | 135 | }
|
127 | 136 |
|
| 137 | + @Target(ElementType.TYPE) |
| 138 | + @Retention(RetentionPolicy.RUNTIME) |
| 139 | + @TestConstructor(autowireMode = ALL) |
| 140 | + @interface AutowireConstructor { |
| 141 | + } |
| 142 | + |
| 143 | + @AutowireConstructor |
| 144 | + static class TestConstructorAsMetaAnnotationTestCase { |
| 145 | + } |
| 146 | + |
128 | 147 | static class AutomaticallyAutowiredTestCase {
|
129 | 148 | }
|
130 | 149 |
|
|
0 commit comments