FailureAnalyzer implementations sometimes need access to the BeanFactory or Environment of the current application context. This is currently supported by allowing a FailureAnalyzer to implement BeanFactoryAware and/or EnvironmentAware. The Aware interfaces aren't ideal, as they require a setter method that does not allow the fields storing the values to be immutable. To improve this situation, Spring Boot should support FailureAnalyzer implementations that accept a BeanFactory and/or Environment as constructor parameters.

We'll mark the BeanFactoryAware and EnvironmentAware support in FailureAnalyzer as deprecated, to be removed in a future release.