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

com.github.codeinghelper.configuration.ExceptionCodeConfiguration Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version

package com.github.codeinghelper.configuration;

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;


@ConfigurationProperties(prefix = "errors")
@PropertySource(value = "classpath:config/exception-code.properties")
@Component
public class ExceptionCodeConfiguration {

    private Map codes = new HashMap<>();

    public Map getCodes() {
        return codes;
    }

    public void setCodes(Map codes) {
        this.codes = codes;
    }


    public String getMessage(int code) {
        String message = codes.get(code);
        return message;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy