I have a Spring Boot server set up, and it can successfully receive requests. It has been set up using OpenAPI to generate the endpoint definitions, which handle the argument conversions.
Now, my problem is I now want to inspect headers that are not part of the request arguments, but just headers as part of the request.
In another Spring Boot application I have set up, I achieved this by adding to the controller
@Autowired
NativeWebRequest request;
Which allowed access to the incoming request.
However, in my current application, this is always null - and I can't get any of the header data. I suspect I have done something incorrectly in the SpringBoot application setup.
// Athena pulled in KeycloakAutoConfiguration when KeycloakAuthorization was added. However, the class
// is not part of the Athena application - so exclude by name since we cannot reference the class here.
@EnableAutoConfiguration(
excludeName = { "org.keycloak.adapters.springboot.KeycloakAutoConfiguration"},
exclude = {
DataSourceAutoConfiguration.class,
ErrorMvcAutoConfiguration.class,
HttpEncodingAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
ThymeleafAutoConfiguration.class,
WebSocketMessagingAutoConfiguration.class,
OAuth2ClientAutoConfiguration.class,
})
@SpringBootConfiguration
public class AthenaApplication extends SpringBootServletInitializer