1, in the construction of Springboot framework encountered problems.
* * WARNING *: Your ApplicationContext is unlikely-to-start due to a @ComponentScan of the default package.
Warning: Your app context might not start because you added the annotations to the default package. There is also a sentence in the following stack message that includes this meaning.
...... This can also happen if is @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the DEFA Ult package by mistake).
(There are other errors when you start, but only the errors associated with this are extracted.) )
2. My project structure is like this (I built the application file in the Java folder below)
3. Reason Analysis
I'm not using @componentscanning annotations, why is there such an annotation?
Springboot when writing the startup class (the class where the Main method resides), if you do not use @componentscan to indicate the object scan scope, the default is to scan the object in the package that contains the current startup class.
(Note: I did not add @componentscan annotations when I wrote the Main method, so that he would scan the objects in the package where application is located)
If the current startup class does not have a package, it will get an error at startup: Your ApplicationContext is unlikely to start due to a @ComponentScan of the default packages.
(Note: The application class that is written in the Java folder is not subordinate to any one package, so the startup class does not have a package)
4. Solutions
Method One, the application is built under the other packages
Method Two, add @componentscan annotation on the application class, specify the package to be scanned
Reference documents
http://blog.csdn.net/u012834750/article/details/65942092
Your ApplicationContext is unlikely-to-start due to a @ComponentScan of the default package