java - IllegalArgumentException: A ServletContext is required -


can't spring boot application running on aws instance.it works fine on machine looks autowiring resolves correctly in 1 environment not in another.looks need clean configuration classes bit.any ideas here? much.

 **main class:**  @configuration @enableautoconfiguration @enableconfigurationproperties @componentscan public class data {    public static void main(string[] args) throws exception {     springapplication.run(data.class, args);  }    } 

configuration:

     @enablewebmvc      @configuration      public class aquiladatawebconfig extends webmvcconfigureradapter {      @override     public void addresourcehandlers(resourcehandlerregistry registry) {         registry.addresourcehandler("/charts/**").addresourcelocations(             "file:///var/lib/aquila/");         registry.addresourcehandler("/**").addresourcelocations(                 "classpath:/static/");     }      @override     public void addviewcontrollers(viewcontrollerregistry registry) {         registry.addviewcontroller("/").setviewname("forward:/index.html");     }      @bean     public internalresourceviewresolver defaultviewresolver() {         // need can forward index.html.         return new internalresourceviewresolver();     } } 

exception:

error starting applicationcontext. display auto-configuration report enabled debug logging (start --debug)   2015-07-09 19:30:55.773 error 18723 [main] --- o.s.boot.springapplication               : application startup failed  org.springframework.beans.factory.beancreationexception: error creating bean name 'defaultservlethandlermapping' defined in class path resource [org/springframework/web/servlet/config/annotation/delegatingwebmvcconfiguration.class]: instantiation of bean failed; nested exception org.springframework.beans.factory.beandefinitionstoreexception: factory method [public org.springframework.web.servlet.handlermapping org.springframework.web.servlet.config.annotation.webmvcconfigurationsupport.defaultservlethandlermapping()] threw exception; nested exception java.lang.illegalargumentexception: servletcontext required configure default servlet handling     @ org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:601)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiateusingfactorymethod(abstractautowirecapablebeanfactory.java:1113)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:1008)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:505)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:476)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:302)     @  

in application.properties (or application.yml), make sure spring.main.web-environment isn't set false. should solve missing servlet context problem.


Comments