spring 静态方法调用实例

@Component
public class Global {

    @Autowired
    private  UserOptionService userOptionService ;

    private static Global global;

    @PostConstruct
    public void init(){
        global = this;
        global.userOptionService = this.userOptionService;
    }

    public static String getOption(String optionName, String lableName){
                UserOption userOption = global.userOptionService.getByOptionName(optionName);
        if(userOption != null){
            Map<String, String> map = (Map<String, String>) JsonMapper.fromJsonString(userOption.getOptionValue(), HashMap.class);
            return map.get(lableName);
        }
        return "";




    }
}
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页