Skip to content

AI Interceptor overwrite default configuration of Spring MVC #422

@mkaszub

Description

@mkaszub

According to the documentation of Spring Boot it automaticly configure Spring MVC.

If you want to keep Spring Boot MVC features, and you just want to add additional MVC configuration (interceptors, formatters, view controllers etc.) you can add your own @configuration class of type WebMvcConfigurerAdapter, but without @EnableWebMvc

If we take look at the applicationinsights.web pacakge there is a class called InterceptorRegistry

https://github.com/Microsoft/ApplicationInsights-Java/blob/420ace24b444a6da61110fcbec7c98e1a3a63c73/web/src/main/java/com/microsoft/applicationinsights/web/spring/internal/InterceptorRegistry.java#L33

So it looks like @EnableWebMvc annotation breaks auto configuration feature.

Reproduction :

  • Add static content under resource folder
  • Add reference to the application insights web package

Expected:

  • Spring Boot Autoconfiguration will configure static content for serving

Actual:

  • Static content is not served

Additional links:
https://stackoverflow.com/questions/46099116/applicationinsights-breaks-default-spring-boot-configuration-for-static-content

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions