static String buildMessage(BeanResolutionContext resolutionContext, String message) {
        BeanResolutionContext.Path path = resolutionContext.getPath();
        BeanDefinition declaringType;
        boolean hasPath = !path.isEmpty();
        if (hasPath) {
            BeanResolutionContext.Segment segment = path.peek();
            declaringType = segment.getDeclaringType();
        } else {
            declaringType = resolutionContext.getRootDefinition();
        }
        String ls = System.getProperty("line.separator");
        StringBuilder builder = new StringBuilder("Error instantiating bean of type  [");
        builder
            .append(declaringType.getName())
            .append("]")
            .append(ls)
            .append(ls);

        if (message != null) {
            builder.append("Message: ").append(message).append(ls);
        }
        if (hasPath) {
            String pathString = path.toString();
            builder.append("Path Taken: ").append(pathString);
        }
        return builder.toString();
    }
static String buildMessage ( BeanResolutionContext resolutionContext , String message ) { BeanResolutionContext . Path path = resolutionContext . getPath ( ) ; BeanDefinition declaringType ; boolean hasPath = ! path . isEmpty ( ) ; if ( hasPath ) { BeanResolutionContext . Segment segment = path . peek ( ) ; declaringType = segment . getDeclaringType ( ) ; } else { declaringType = resolutionContext . getRootDefinition ( ) ; } String ls = System . getProperty ( "line.separator" ) ; StringBuilder builder = new StringBuilder ( "Error instantiating bean of type  [" ) ; builder . append ( declaringType . getName ( ) ) . append ( "]" ) . append ( ls ) . append ( ls ) ; if ( message != null ) { builder . append ( "Message: " ) . append ( message ) . append ( ls ) ; } if ( hasPath ) { String pathString = path . toString ( ) ; builder . append ( "Path Taken: " ) . append ( pathString ) ; } return builder . toString ( ) ; }
Builds an appropriate error message.

@param resolutionContext The resolution context
@param message           The message
@return The message