private static String getDescription(final BeanDefinitionStoreException ex) {
        val causedMsg = ExceptionUtils.getRootCauseMessage(ex);
        val description = new StringWriter();
        try (val printer = new PrintWriter(description)) {
            printer.printf("Error creating bean");
            if (ex.getBeanName() != null) {
                printer.printf(" named %s", ex.getBeanName());
            }
            if (ex.getResourceDescription() != null) {
                printer.printf(", with resource description %s,", ex.getResourceDescription());
            }
            printer.printf(" due to: %s ", ex.getMessage());
            if (StringUtils.isNotBlank(causedMsg)) {
                printer.printf(" caused by %s ", causedMsg);
            }
        }
        return description.toString();
    }
Failure analyzer for spring boot startup exceptions from {@link BeanDefinitionStoreException}.

@author Hal Deadman
@since 6.4.0
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/spring/boot/BeanDefinitionStoreFailureAnalyzer.java