zoukankan      html  css  js  c++  java
  • springboot 静态注入 单例

    package com.b2q.web_push.util;
    
    
    import io.goeasy.GoEasy;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.stereotype.Component;
    
    @Component
    public class GoEasyUtil {
    
        private static String regionHost; //服务商网址
        private static String appkey ;//官网appkey
    
        @Value("${regionHost}")
        public void setregionHost(String regionHost){
            GoEasyUtil.regionHost = regionHost;
        }
        public static String getregionHost() {
            return regionHost;
        }
    
        @Value("${appkey}")
        public void setappkey(String appkey){
            GoEasyUtil.appkey = appkey;
        }
        public static String getappkey() {
            return appkey;
        }
        private static class GoEasyUtil1
        {
            public final static GoEasy instance = new GoEasy(regionHost,appkey);
        }
    
        public static GoEasy getGoEasy()
        {
            return GoEasyUtil1.instance;
        }
    
    
    }
  • 相关阅读:
    去除文件中的空行
    数据分析 numpy matplotlib
    程序员
    c#
    java
    微信小游戏
    小游戏开发手册
    模板
    微信小程序小程序代码构成(.json .js .wxss .wxml)
    微信程序
  • 原文地址:https://www.cnblogs.com/mytzq/p/9883579.html
Copyright © 2011-2022 走看看