문제

I would like to create a Spring Boot application to be deployed on Google AppEngine infrastructure. GAE currently only supports servlet 2.5 web applications.

Is it possible to use Spring Boot - using auto-configuration - in combination with a old-fashioned web.xml?

Can I for example use a contextClass/contextConfigLocation pointing to a @Configration class including @EnableAutoConfiguration?

All Spring Boot examples seem to use a simple Application class with main method to run the application. So I would like to know if Spring Boot supports using a web.xml as start point to boot the application?

도움이 되었습니까?

해결책

More than one question there:

  • There's nothing stopping you from using web.xml (it's still part of the Servlet spec). Most people prefer the Java initializers these days.

  • @EnableAutoConfiguration works for any application context (it just uses features of Spring).

  • But Spring Boot out of the box doesn't have a ContextLoaderListener that knows about SpringApplication, so you miss some of the benefits of Boot if you do as you describe. There's one you might find useful here.

  • Spring Boot Actuator relies on a few Servlet 3.0 features here and there so you need workarounds for a 2.5 environment (see this spring-boot-legacy prototype for details).

There's a sample app here that runs on GAE, currently deployed here: http://dsyerboot.appspot.com/.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top