问题
There's a specific version of this question and a general version; I'll ask it both ways.
Specific Question
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.
General Question
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?
回答1:
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).
来源:https://stackoverflow.com/questions/29102977/exclude-certain-webapplicationinitializers-in-cloudfoundry-war-deploy