Commit 43108d54 authored by Phillip Webb's avatar Phillip Webb

Add @SpringBootApplication.scanBasePackages note

Update the javadoc to note that `scanBasePackages` only affects the
`@ComponentScan` annotation and isn't a replacement for `@EntityScan`
or `@Enable...Repositories`.

Closes gh-18109
parent 8e6dbae4
...@@ -31,6 +31,7 @@ import org.springframework.context.annotation.ComponentScan.Filter; ...@@ -31,6 +31,7 @@ import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.FilterType;
import org.springframework.core.annotation.AliasFor; import org.springframework.core.annotation.AliasFor;
import org.springframework.data.repository.Repository;
/** /**
* Indicates a {@link Configuration configuration} class that declares one or more * Indicates a {@link Configuration configuration} class that declares one or more
...@@ -72,6 +73,12 @@ public @interface SpringBootApplication { ...@@ -72,6 +73,12 @@ public @interface SpringBootApplication {
/** /**
* Base packages to scan for annotated components. Use {@link #scanBasePackageClasses} * Base packages to scan for annotated components. Use {@link #scanBasePackageClasses}
* for a type-safe alternative to String-based package names. * for a type-safe alternative to String-based package names.
* <p>
* <strong>Note:</strong> this setting is an alias for
* {@link ComponentScan @ComponentScan} only. It has no effect on {@code @Entity}
* scanning or Spring Data {@link Repository} scanning. For those you should add
* {@link org.springframework.boot.autoconfigure.domain.EntityScan @EntityScan} and
* {@code @Enable...Repositories} annotations.
* @return base packages to scan * @return base packages to scan
* @since 1.3.0 * @since 1.3.0
*/ */
...@@ -84,6 +91,12 @@ public @interface SpringBootApplication { ...@@ -84,6 +91,12 @@ public @interface SpringBootApplication {
* <p> * <p>
* Consider creating a special no-op marker class or interface in each package that * Consider creating a special no-op marker class or interface in each package that
* serves no purpose other than being referenced by this attribute. * serves no purpose other than being referenced by this attribute.
* <p>
* <strong>Note:</strong> this setting is an alias for
* {@link ComponentScan @ComponentScan} only. It has no effect on {@code @Entity}
* scanning or Spring Data {@link Repository} scanning. For those you should add
* {@link org.springframework.boot.autoconfigure.domain.EntityScan @EntityScan} and
* {@code @Enable...Repositories} annotations.
* @return base packages to scan * @return base packages to scan
* @since 1.3.0 * @since 1.3.0
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment