Skip to content

Add @ConditionalOnWebApplication for those autoconfigurations depending on web #405

@joshiste

Description

@joshiste

I use problem-spring-web-starter:0.25.2 and want to run @SpringBootTest with spring.main.web-application-type=none.

The application context can't be initialized as the SecurityProblemSupport depends on some beans only created for web contexts. All configurations depending on those beans, should be guarded with @ConditionalOnWebApplication so that they won't be loaded.

Error Output:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in org.zalando.problem.spring.web.advice.security.SecurityProblemSupport required a bean of type 'org.springframework.web.servlet.HandlerExceptionResolver' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Qualifier(value="handlerExceptionResolver")

The following candidates were found but could not be injected:
	- Bean method 'errorAttributes' in 'ErrorMvcAutoConfiguration' not loaded because not a servlet web application


Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.web.servlet.HandlerExceptionResolver' in your configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions