|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2013 the original author or authors. |
| 2 | + * Copyright 2002-2014 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.
|
@@ -93,22 +93,45 @@ else if (isLiteConfigurationCandidate(metadata)) {
|
93 | 93 | return false;
|
94 | 94 | }
|
95 | 95 |
|
| 96 | + /** |
| 97 | + * Check the given metadata for a configuration class candidate |
| 98 | + * (or nested component class declared within a configuration/component class). |
| 99 | + * @param metadata the metadata of the annotated class |
| 100 | + * @return {@code true} if the given class is to be registered as a |
| 101 | + * reflection-detected bean definition; {@code false} otherwise |
| 102 | + */ |
96 | 103 | public static boolean isConfigurationCandidate(AnnotationMetadata metadata) {
|
97 | 104 | return (isFullConfigurationCandidate(metadata) || isLiteConfigurationCandidate(metadata));
|
98 | 105 | }
|
99 | 106 |
|
| 107 | + /** |
| 108 | + * Check the given metadata for a full configuration class candidate |
| 109 | + * (i.e. a class annotated with {@code @Configuration}). |
| 110 | + * @param metadata the metadata of the annotated class |
| 111 | + * @return {@code true} if the given class is to be processed as a full |
| 112 | + * configuration class, including cross-method call interception |
| 113 | + */ |
100 | 114 | public static boolean isFullConfigurationCandidate(AnnotationMetadata metadata) {
|
101 | 115 | return metadata.isAnnotated(Configuration.class.getName());
|
102 | 116 | }
|
103 | 117 |
|
| 118 | + /** |
| 119 | + * Check the given metadata for a lite configuration class candidate |
| 120 | + * (e.g. a class annotated with {@code @Component} or just having |
| 121 | + * {@code @Bean methods}). |
| 122 | + * @param metadata the metadata of the annotated class |
| 123 | + * @return {@code true} if the given class is to be processed as a lite |
| 124 | + * configuration class, just registering it and scanning it for {@code @Bean} methods |
| 125 | + */ |
104 | 126 | public static boolean isLiteConfigurationCandidate(AnnotationMetadata metadata) {
|
105 | 127 | // Do not consider an interface or an annotation...
|
106 | 128 | return (!metadata.isInterface() && (
|
107 | 129 | metadata.isAnnotated(Component.class.getName()) || metadata.hasAnnotatedMethods(Bean.class.getName())));
|
108 | 130 | }
|
109 | 131 |
|
110 | 132 | /**
|
111 |
| - * Determine whether the given bean definition indicates a full @Configuration class. |
| 133 | + * Determine whether the given bean definition indicates a full |
| 134 | + * {@code @Configuration} class. |
112 | 135 | */
|
113 | 136 | public static boolean isFullConfigurationClass(BeanDefinition beanDef) {
|
114 | 137 | return CONFIGURATION_CLASS_FULL.equals(beanDef.getAttribute(CONFIGURATION_CLASS_ATTRIBUTE));
|
|
0 commit comments