|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2015 the original author or authors. |
| 2 | + * Copyright 2012-2016 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.
|
|
28 | 28 | import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
29 | 29 | import org.springframework.core.annotation.AnnotationAttributes;
|
30 | 30 | import org.springframework.core.type.AnnotationMetadata;
|
31 |
| -import org.springframework.util.Assert; |
32 | 31 | import org.springframework.util.ClassUtils;
|
33 |
| -import org.springframework.util.ObjectUtils; |
34 | 32 |
|
35 | 33 | /**
|
36 | 34 | * {@link ImportBeanDefinitionRegistrar} used by {@link ServletComponentScan}.
|
37 | 35 | *
|
38 | 36 | * @author Andy Wilkinson
|
| 37 | + * @author Stephane Nicoll |
39 | 38 | */
|
40 | 39 | class ServletComponentScanRegistrar implements ImportBeanDefinitionRegistrar {
|
41 | 40 |
|
@@ -77,16 +76,9 @@ private void addPostProcessor(BeanDefinitionRegistry registry,
|
77 | 76 | private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
|
78 | 77 | AnnotationAttributes attributes = AnnotationAttributes.fromMap(
|
79 | 78 | metadata.getAnnotationAttributes(ServletComponentScan.class.getName()));
|
80 |
| - String[] value = attributes.getStringArray("value"); |
81 | 79 | String[] basePackages = attributes.getStringArray("basePackages");
|
82 | 80 | Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
|
83 |
| - if (!ObjectUtils.isEmpty(value)) { |
84 |
| - Assert.state(ObjectUtils.isEmpty(basePackages), |
85 |
| - "@ServletComponentScan basePackages and value attributes are" |
86 |
| - + " mutually exclusive"); |
87 |
| - } |
88 | 81 | Set<String> packagesToScan = new LinkedHashSet<String>();
|
89 |
| - packagesToScan.addAll(Arrays.asList(value)); |
90 | 82 | packagesToScan.addAll(Arrays.asList(basePackages));
|
91 | 83 | for (Class<?> basePackageClass : basePackageClasses) {
|
92 | 84 | packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
|
|
0 commit comments