@ComponentScan when you can not add

In the case where no SpringBoot @ComponentScan the configuration, only the default class is Class main scanning and the same package.

The main class Application.java:

Import org.springframework.boot.SpringApplication;
 Import org.springframework.boot.autoconfigure.SpringBootApplication; 
 
@SpringBootApplication 
// @ ComponentScan (basePackages =. "COM Custom .mall") If not, only the main scan in the same package type Class under.
public class the Application { public static void main (String [] args) { SpringApplication.run (the Application. class , args); } }

Without availability

The situation needed to be added

 

Guess you like

Origin www.cnblogs.com/dianzan/p/11183024.html