In the embedded servlet environment, this annotation enables the scanning for @WebServlet, @WebFilter and @WebListener components. Let's have a look at it's definition:
value() or basePackage: specifies base package name to be scanned
basePackageClasses: specifies classes whose package(s) will be scanned
Examples
package com.logicbig.example;
import org.springframework.boot.Banner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; @ServletComponentScan @SpringBootApplication public class Main {
public static void main (String[] args) { SpringApplication sa = new SpringApplication(Main.class); sa.setLogStartupInfo(false); sa.setBannerMode(Banner.Mode.OFF); sa.run(args); } }