spring_reference/IX. ‘How-to’ guides/67.4. Separate @Entity defi...

14 lines
377 B
Markdown
Raw Normal View History

### 67.4. 从Spring配置分离`@Entity`定义
Spring Boot会基于它找到的`@EnableAutoConfiguration`来尝试猜测你的`@Entity`定义的位置。想要获取更多控制,你可以使用`@EntityScan`注解,比如:
```java
@Configuration
@EnableAutoConfiguration
@EntityScan(basePackageClasses=City.class)
public class Application {
//...
}
```