How to check two condition while using @ConditionalOnProperty or @ConditionalOnExpression

Use @ConditionalOnExpression annotation and SpEL expression as described here http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html.

Example:

@Controller
@ConditionalOnExpression("${controller.enabled} and ${some.value} > 10")
public class WebController {

Leave a Comment