class SessionAttributesMapArgumentResolver implements ArgumentResolver {

    @Override
    public Optional<Object> resolve(ArgumentResolverContext input) {
        if (input.parameterTypeEquals(Map.class)
            && input.getMethodParameter().findAnnotation(SessionAttributes.class).isPresent()) {

            return Optional.of(input.getHandlerInput().getAttributesManager().getSessionAttributes());
        }
        return Optional.empty();
    }

}