Spring Boot是否支持servlet 2.5自动配置? [英] Does Spring Boot support servlet 2.5 auto-configuration?

查看:205
本文介绍了Spring Boot是否支持servlet 2.5自动配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个Spring Boot应用程序以部署在Google AppEngine基础架构上。 GAE目前仅支持servlet 2.5 web应用程序。



是否可以将Spring Boot(使用自动配置)与旧式web.xml结合使用?

所有Spring Boot示例似乎使用一个简单的Application类和main方法来运行应用程序。所以我想知道Spring Boot是否支持使用web.xml作为起点来引导应用程序? 解决方案

超过在那里有一个问题:



有一个示例应用此处运行目前部署在GAE上: http://dsyerboot.appspot.com/


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/.

这篇关于Spring Boot是否支持servlet 2.5自动配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆