15
15
*/
16
16
package org .springframework .data .repository .config ;
17
17
18
+ import lombok .extern .slf4j .Slf4j ;
19
+
18
20
import java .util .ArrayList ;
19
21
import java .util .List ;
22
+ import java .util .stream .Collectors ;
20
23
21
24
import javax .annotation .Nullable ;
22
25
23
- import org .slf4j .Logger ;
24
- import org .slf4j .LoggerFactory ;
25
26
import org .springframework .beans .factory .parsing .BeanComponentDefinition ;
26
27
import org .springframework .beans .factory .support .AbstractBeanDefinition ;
27
28
import org .springframework .beans .factory .support .BeanDefinitionBuilder ;
43
44
* @author Oliver Gierke
44
45
* @author Jens Schauder
45
46
*/
47
+ @ Slf4j
46
48
public class RepositoryConfigurationDelegate {
47
49
48
- private static final Logger LOGGER = LoggerFactory .getLogger (RepositoryConfigurationDelegate .class );
49
-
50
50
private static final String REPOSITORY_REGISTRATION = "Spring Data {} - Registering repository: {} - Interface: {} - Factory: {}" ;
51
51
private static final String MULTIPLE_MODULES = "Multiple Spring Data modules found, entering strict repository configuration mode!" ;
52
52
@@ -117,6 +117,11 @@ public List<BeanComponentDefinition> registerRepositoriesIn(BeanDefinitionRegist
117
117
environment );
118
118
List <BeanComponentDefinition > definitions = new ArrayList <>();
119
119
120
+ if (LOG .isDebugEnabled ()) {
121
+ LOG .debug ("Scanning for repositories in packages {}." ,
122
+ configurationSource .getBasePackages ().stream ().collect (Collectors .joining (", " )));
123
+ }
124
+
120
125
for (RepositoryConfiguration <? extends RepositoryConfigurationSource > configuration : extension
121
126
.getRepositoryConfigurations (configurationSource , resourceLoader , inMultiStoreMode )) {
122
127
@@ -133,9 +138,9 @@ public List<BeanComponentDefinition> registerRepositoriesIn(BeanDefinitionRegist
133
138
AbstractBeanDefinition beanDefinition = definitionBuilder .getBeanDefinition ();
134
139
String beanName = configurationSource .generateBeanName (beanDefinition );
135
140
136
- if (LOGGER .isDebugEnabled ()) {
137
- LOGGER .debug (REPOSITORY_REGISTRATION , extension .getModuleName (), beanName ,
138
- configuration .getRepositoryInterface (), configuration . getRepositoryFactoryBeanClassName ());
141
+ if (LOG .isDebugEnabled ()) {
142
+ LOG .debug (REPOSITORY_REGISTRATION , extension .getModuleName (), beanName , configuration . getRepositoryInterface () ,
143
+ configuration .getRepositoryFactoryBeanClassName ());
139
144
}
140
145
141
146
beanDefinition .setAttribute (FACTORY_BEAN_OBJECT_TYPE , configuration .getRepositoryInterface ());
@@ -144,6 +149,10 @@ public List<BeanComponentDefinition> registerRepositoriesIn(BeanDefinitionRegist
144
149
definitions .add (new BeanComponentDefinition (beanDefinition , beanName ));
145
150
}
146
151
152
+ if (LOG .isDebugEnabled ()) {
153
+ LOG .debug ("Finished repository scanning." );
154
+ }
155
+
147
156
return definitions ;
148
157
}
149
158
@@ -160,7 +169,7 @@ private boolean multipleStoresDetected() {
160
169
.loadFactoryNames (RepositoryFactorySupport .class , resourceLoader .getClassLoader ()).size () > 1 ;
161
170
162
171
if (multipleModulesFound ) {
163
- LOGGER .info (MULTIPLE_MODULES );
172
+ LOG .info (MULTIPLE_MODULES );
164
173
}
165
174
166
175
return multipleModulesFound ;
0 commit comments