Spring Boot App Unable to start


This exception come because application main class has following attributes missing

@ComponentScan
@EnableAutoConfiguration

package code4copy.com;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan
@EnableAutoConfiguration
public class Program {
     public static void main(String[] args) {
            SpringApplication.run(Program.class, args);
        }
}

The @ComponentScan annotation tells Spring to search and register recursively through the code4copy.com package and its children for classes marked directly or indirectly with Spring’s @Componentannotation.

The @EnableAutoConfiguration annotation switches on reasonable default behaviours based on the content of your classpath. Application depends on the embeddable version of Tomcat and SpringMVC a Tomcat server with SpringMVC is set up and configured with reasonable defaults on your behalf.