liveBook · Manning

/conditions endpoint

As explained in Spring in Action, Sixth Edition

The /conditions endpoint is a Spring Boot Actuator HTTP endpoint that reports the outcomes of conditional autoconfiguration.

The /conditions endpoint is a Spring Boot Actuator diagnostic endpoint. It returns JSON showing which conditional autoconfiguration decisions matched, which did not, and which classes were unconditional. section 15.2.2

Reading a condition result

A positive match can show that MongoDataAutoConfiguration created a mongoTemplate because no matching MongoTemplate bean was found. A negative match can show that DispatcherServletAutoConfiguration did not apply because the required DispatcherServlet class was missing. section 15.2.2

{
  "contexts": {
    "application-1": {
      "positiveMatches": {
...
        "MongoDataAutoConfiguration#mongoTemplate": [
          {
            "condition": "OnBeanCondition",
            "message": "@ConditionalOnMissingBean (types:
                org.springframework.data.mongodb.core.MongoTemplate;
                SearchStrategy: all) did not find any beans"
          }
        ],
...
      },
      "negativeMatches": {
...
        "DispatcherServletAutoConfiguration": {
          "notMatched": [
            {
              "condition": "OnClassCondition",
              "message": "@ConditionalOnClass did not find required
                  class 'org.springframework.web.servlet.
                                                 DispatcherServlet'"
            }
          ],
          "matched": []
        },
...
      },
      "unconditionalClasses": [
...
        "org.springframework.boot.autoconfigure.context.
                          ConfigurationPropertiesAutoConfiguration",
...
      ]
    }
  }
}

Browse the endpoint response to compare positiveMatches, negativeMatches, and unconditionalClasses, then inspect each condition and its explanatory message. section 15.2.2

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains matched and unmatched conditions through JSON messages, without detailing the condition implementation internals.
Examples
Uses MongoDataAutoConfiguration and DispatcherServletAutoConfiguration results to illustrate positive and negative matches.
What you can do after
Diagnose unexpected application configuration by inspecting condition outcomes and their explanatory messages.
How it connects
Connects autoconfiguration with conditional beans and the Spring application context.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.