|
1 | 1 | /**
|
2 |
| - * Copyright 2015-2018 the original author or authors. |
| 2 | + * Copyright 2015-2019 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.
|
@@ -188,28 +188,28 @@ public static class AutoConfiguredMapperScannerRegistrar
|
188 | 188 | @Override
|
189 | 189 | public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
190 | 190 |
|
191 |
| - logger.debug("Searching for mappers annotated with @Mapper"); |
192 |
| - |
193 |
| - ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); |
| 191 | + if (!AutoConfigurationPackages.has(this.beanFactory)) { |
| 192 | + logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled."); |
| 193 | + return; |
| 194 | + } |
194 | 195 |
|
195 |
| - try { |
196 |
| - if (this.resourceLoader != null) { |
197 |
| - scanner.setResourceLoader(this.resourceLoader); |
198 |
| - } |
| 196 | + logger.debug("Searching for mappers annotated with @Mapper"); |
199 | 197 |
|
200 |
| - List<String> packages = AutoConfigurationPackages.get(this.beanFactory); |
201 |
| - if (logger.isDebugEnabled()) { |
202 |
| - for (String pkg : packages) { |
203 |
| - logger.debug("Using auto-configuration base package '{}'", pkg); |
204 |
| - } |
| 198 | + List<String> packages = AutoConfigurationPackages.get(this.beanFactory); |
| 199 | + if (logger.isDebugEnabled()) { |
| 200 | + for (String pkg : packages) { |
| 201 | + logger.debug("Using auto-configuration base package '{}'", pkg); |
205 | 202 | }
|
| 203 | + } |
206 | 204 |
|
207 |
| - scanner.setAnnotationClass(Mapper.class); |
208 |
| - scanner.registerFilters(); |
209 |
| - scanner.doScan(StringUtils.toStringArray(packages)); |
210 |
| - } catch (IllegalStateException ex) { |
211 |
| - logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled.", ex); |
| 205 | + ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); |
| 206 | + if (this.resourceLoader != null) { |
| 207 | + scanner.setResourceLoader(this.resourceLoader); |
212 | 208 | }
|
| 209 | + scanner.setAnnotationClass(Mapper.class); |
| 210 | + scanner.registerFilters(); |
| 211 | + scanner.doScan(StringUtils.toStringArray(packages)); |
| 212 | + |
213 | 213 | }
|
214 | 214 |
|
215 | 215 | @Override
|
|
0 commit comments