spring_reference/III. Using Spring Boot/14.1. Using the “default” p...

6 lines
492 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 14.1. 使用"default"包
当类没有包含`package`声明时,它被认为处于`default package`下。通常不推荐使用`default package`,并应该避免使用它。因为对于使用`@ComponentScan``@EntityScan`或`@SpringBootApplication`注解的Spring Boot应用来说来自每个jar的类都会被读取这会造成一定的问题。
**注**我们建议你遵循Java推荐的包命名规范使用一个反转的域名例如`com.example.project`)。