在CloudFoundry WAR部署中排除某些WebApplicationInitializers [英] Exclude certain WebApplicationInitializers in CloudFoundry WAR deploy
问题描述
此问题有特定版本和一般版本;我会双向询问.
There's a specific version of this question and a general version; I'll ask it both ways.
特定问题
我们有一个传统的Spring Web应用程序,该应用程序与我们正在推向Cloud Foundry的Apache Camel集成.它取决于一个引入 spring-cloud-security
(因此, spring-boot-autoconfigure
等)的自定义库.部署到Cloud Foundry时,Java自动重新配置会在类路径上查找 WebApplicationInitializer
,发现的是 JerseyAutoConfiguration
.当它调用那个特定的 WebApplicationInitializer
时,我们得到注释解析错误.有没有办法排除那个人? @EnableAutoConfiguration(exclude = ...)
不起作用,因为在自动配置"步骤中没有发生这种情况.
We have a traditional Spring Web application that integrates with Apache Camel that we're pushing to Cloud Foundry. It depends on a custom library that pulls in spring-cloud-security
(and therefore, spring-boot-autoconfigure
, among others). When deploying to Cloud Foundry, the Java Autoreconfiguration looks for WebApplicationInitializer
s on the classpath and one that it finds is JerseyAutoConfiguration
. When it invokes that particular WebApplicationInitializer
, we get annotation parsing errors. Is there a way to exclude that one? @EnableAutoConfiguration(exclude=...)
doesn't work because this isn't happening during the AutoConfiguration step.
一般问题
是否可以通过 web.xml
或其他工具告知Java Autoreconfigure代码(通过Java buildpack包含)跳过执行某些 WebApplicationInitializer
?
Is there a way, via web.xml
or some other facility, to tell the Java Autoreconfigure code (included via the Java buildpack) to skip executing certain WebApplicationInitializer
s?
推荐答案
如果将应用程序部署为可执行文件而不是WAR,则不会扫描 WebApplicationInitializers
(这不是Spring的事情)一个buildpack东西).
If you deploy the app as an executable instead of as a WAR then there is no scanning for WebApplicationInitializers
(it's a Spring thing not a buildpack thing).
这篇关于在CloudFoundry WAR部署中排除某些WebApplicationInitializers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!