About SpringBoot annotation scan scope

  Experienced the development of a multi-module project developed by an idea. A new module cannot always access information about the annotation configuration such as beans and aspects in the basic public module. After bothering for a long time, I found out that I didn't understand the SpringBoot annotation scanning scope convention and put the Application.java entry file of the new project too deep in the package.

  Attachment: SpringBoot annotation scanning scope convention
  The annotation scanning default rule of SpringBoot project is to scan from top to bottom according to the package location where the Application class is located!
  "Application class" refers to the SpringBoot project entry class. The location of this class is critical. If the package where the Application class is located is: com.iteye.wallimn, only the com.iteye.wallimn package and all its subpackages will be scanned. If the package where the service or dao is located is not under com.iteye.wallimn and its subpackages, it will not be scanned. will be scanned!
  If the Application class is placed in the com.iteye.wallimn.app package, the same level package and uncle package as the app will not be scanned.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326988168&siteId=291194637
Recommended