All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.boot.auth.starter.service.impl.DefaultOutJsonServiceImpl Maven / Gradle / Ivy

There is a newer version: 1.0.0.4
Show newest version
package com.boot.auth.starter.service.impl;

import com.boot.auth.starter.exception.AuthException;
import com.boot.auth.starter.service.OutJsonService;
import com.boot.auth.starter.vo.DefaultResponseVO;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Component;

@Component
public class DefaultOutJsonServiceImpl implements OutJsonService {
    final
    ObjectMapper objectMapper;

    public DefaultOutJsonServiceImpl(ObjectMapper objectMapper) {
        this.objectMapper = objectMapper;
    }

    @Override
    public String errorOutJson(String msg, String code) {
        try {
            return objectMapper.writeValueAsString(new DefaultResponseVO(msg, code));
        } catch (Exception e) {
            throw new AuthException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy