Getting error to connect database after using @Component

Using @Component annotation in Spring Cron, cron is running well, but another configuration is not working, like database connection is not established, loggers are not printing Getting error while login from the web project

Below is my code

@org.springframework.boot.autoconfigure.SpringBootApplication
@ComponentScan(basePackages= {"com.ravi","com.ravi.main"})
@EnableScheduling
public class SpringBootApplication extends SpringBootServletInitializer{

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SpringBootApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringBootApplication.class, args);       
    }

}

And below code is cron

@Component
@Lazy(false)
public class CleanDataJob {
    private static Logger logger = Logger.getLogger(CleanDataJob.class);
    @Scheduled
    public void deleteData() {
        // Cleaning data job code       
    }
    
}

Cron is added in com.ravi.main package After deleting @Component all database connections are working fine but, cron is not running


Check for @Autowired annotation that is left inside the @Component annotated class