7 changed files with 301 additions and 73 deletions
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
/* |
||||
* Copyright 2012-2022 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 |
||||
* |
||||
* https://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.autoconfigureprocessor; |
||||
|
||||
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.core.annotation.AliasFor; |
||||
|
||||
/** |
||||
* Alternative to Spring Boot's {@code @AutoConfiguration} for testing (removes the need |
||||
* for a dependency on the real annotation). |
||||
* |
||||
* @author Moritz Halbritter |
||||
*/ |
||||
@Target(ElementType.TYPE) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
@TestAutoConfigureBefore |
||||
@TestAutoConfigureAfter |
||||
public @interface TestAutoConfiguration { |
||||
|
||||
@AliasFor(annotation = TestAutoConfigureBefore.class, attribute = "value") |
||||
Class<?>[] before() default {}; |
||||
|
||||
@AliasFor(annotation = TestAutoConfigureBefore.class, attribute = "name") |
||||
String[] beforeName() default {}; |
||||
|
||||
@AliasFor(annotation = TestAutoConfigureAfter.class, attribute = "value") |
||||
Class<?>[] after() default {}; |
||||
|
||||
@AliasFor(annotation = TestAutoConfigureAfter.class, attribute = "name") |
||||
String[] afterName() default {}; |
||||
|
||||
} |
||||
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
/* |
||||
* Copyright 2012-2022 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 |
||||
* |
||||
* https://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.autoconfigureprocessor; |
||||
|
||||
import java.io.InputStream; |
||||
import java.io.OutputStream; |
||||
|
||||
/** |
||||
* Test @AutoConfiguration aliases for @AutoConfigureBefore and @AutoConfigureAfter. |
||||
* |
||||
* @author Moritz Halbritter |
||||
*/ |
||||
@TestAutoConfiguration(before = InputStream.class, beforeName = { "test.before1", "test.before2" }, |
||||
after = OutputStream.class, afterName = { "test.after1", "test.after2" }) |
||||
public class TestAutoConfigurationConfiguration { |
||||
|
||||
} |
||||
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/* |
||||
* Copyright 2012-2022 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 |
||||
* |
||||
* https://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.autoconfigureprocessor; |
||||
|
||||
import java.io.InputStream; |
||||
import java.io.ObjectInputStream; |
||||
import java.io.ObjectOutputStream; |
||||
import java.io.OutputStream; |
||||
|
||||
/** |
||||
* Test @AutoConfiguration aliases together with @AutoConfigureBefore |
||||
* and @AutoConfigureAfter. |
||||
* |
||||
* @author Moritz Halbritter |
||||
*/ |
||||
@TestAutoConfigureBefore(value = InputStream.class, name = { "test.before1", "test.before2" }) |
||||
@TestAutoConfigureAfter(value = OutputStream.class, name = { "test.after1", "test.after2" }) |
||||
@TestAutoConfiguration(before = ObjectInputStream.class, beforeName = { "test.before3", "test.before4" }, |
||||
after = ObjectOutputStream.class, afterName = { "test.after3", "test.after4" }) |
||||
public class TestMergedAutoConfigurationConfiguration { |
||||
|
||||
} |
||||
Loading…
Reference in new issue