注释类型 EntityScan


  • @Target(TYPE)
    @Retention(RUNTIME)
    @Documented
    @Import(org.springframework.boot.autoconfigure.domain.EntityScanPackages.Registrar.class)
    public @interface EntityScan
    Configures the base packages used by auto-configuration when scanning for entity classes.

    Using @EntityScan will cause auto-configuration to:

    • Set the packages scanned for JPA entities.
    • Set the packages used with Neo4J's SessionFactory.
    • Set the initial entity set used with Spring Data MongoDB, Cassandra and Couchbase mapping contexts.

    One of basePackageClasses(), basePackages() or its alias value() may be specified to define specific packages to scan. If specific packages are not defined scanning will occur from the package of the class with this annotation.

    从以下版本开始:
    1.4.0
    另请参阅:
    EntityScanPackages
    • 元素详细资料

      • value

        @AliasFor("basePackages")
        String[] value
        Alias for the basePackages() attribute. Allows for more concise annotation declarations e.g.: @EntityScan("org.my.pkg") instead of @EntityScan(basePackages="org.my.pkg").
        返回:
        the base packages to scan
        默认值:
        {}
      • basePackages

        @AliasFor("value")
        String[] basePackages
        Base packages to scan for entities. value() is an alias for (and mutually exclusive with) this attribute.

        Use basePackageClasses() for a type-safe alternative to String-based package names.

        返回:
        the base packages to scan
        默认值:
        {}
      • basePackageClasses

        Class<?>[] basePackageClasses
        Type-safe alternative to basePackages() for specifying the packages to scan for entities. The package of each class specified will be scanned.

        Consider creating a special no-op marker class or interface in each package that serves no purpose other than being referenced by this attribute.

        返回:
        classes from the base packages to scan
        默认值:
        {}