Error with Spring BOOT

@EnableAutoConfiguration also does auto configs for WebMvc, so pls exclude this as well :-

@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,WebMvcAutoConfiguration.class })

By default SpringApplication, will deduce whether or not you're building a web application based on what's on the classpath. If you have some Web-related dependencies on the classpath but aren't building a web application, you can explicitly tell SpringApplication that you don't want a web application:

app.setWebEnvironment(false);

This is preferable to explicitly disabling Web-related auto-configuration as it means you don't need to know what those auto-configuration classes are and lets Spring Boot take care of it for you.