坚决不要在默认包下使用扫描注解等操作,引发不可描述的异常
官方文档有一小段说明:
14.1 Using the “default” Package
When a class does not include a package declaration, it is considered to be in the “default package”. The use of the “default package” is generally discouraged and should be avoided. It can cause particular problems for Spring Boot applications that use the @ComponentScan, @EntityScan, or @SpringBootApplicationannotations, since every class from every jar is read.
探讨在默认包中使用@ComponentScan、@EntityScan或@SpringBootApplication等注解可能导致的问题,特别是对于Spring Boot应用,可能引起不可预知的异常,因为会读取每一个jar包中的所有类。
1002

被折叠的 条评论
为什么被折叠?



