Blame view

RemoteProperties.java 916 Bytes
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
package com.meishu.common.configure;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  读取状态码
 * </p>
 *
 * @author DengMin
 * @date Created in 2020/08/24   
 */
@Component
@ConfigurationProperties(prefix = "meishu")
@PropertySource(value = "classpath:code.properties", encoding = "UTF-8")
public class RemoteProperties {

    private static Map<Integer, String> codeMessage = new HashMap<>();

    public static String getMessage(Integer code) {
        return codeMessage.get(code);
    }

    public Map<Integer, String> getCodeMessage() {
        return codeMessage;
    }

    public void setCodeMessage(Map<Integer, String> codeMessage) {
        RemoteProperties.codeMessage = codeMessage;
    }
}