美文网首页
工具类中静态方法用到注入对象

工具类中静态方法用到注入对象

作者: hehehehe | 来源:发表于2020-07-17 00:04 被阅读0次
    
    package com.ecarx.ads.processstore.config;
    
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.context.annotation.PropertySource;
    import org.springframework.stereotype.Component;
    
    import javax.annotation.PostConstruct;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Set;
    
    /**
     * 类描述 <p>
     * @since 2020/7/6 14:31
     */
    @Component
    @PropertySource(value = "classpath:process-path.properties")
    public class ProcessPathConfig {
    
        public static String imp_split_info_src;
    
        public static String imp_overedge_deduplicate_src;
    
        public static String imp_recognition_src;
    
        public static String imp_manbuild_src;
    
        public static String imp_build_service_src;
    
        public static Map<String, Map<String, String>> processInfoMap = null;
    
        @Value("#{'${imp_split_info_src}'}")
        public void setImp_split_info_src(String imp_split_info_src) {
            ProcessPathConfig.imp_split_info_src = imp_split_info_src;
        }
    
        @Value("#{'${imp_overedge_deduplicate_src}'}")
        public void setImp_overedge_deduplicate_src(String imp_overedge_deduplicate_src) {
            ProcessPathConfig.imp_overedge_deduplicate_src = imp_overedge_deduplicate_src;
        }
    
        @Value("#{'${imp_recognition_src}'}")
        public void setImp_recognition_src(String imp_recognition_src) {
            ProcessPathConfig.imp_recognition_src = imp_recognition_src;
        }
    
        @Value("#{'${imp_manbuild_src}'}")
        public void setImp_manbuild_src(String imp_manbuild_src) {
            ProcessPathConfig.imp_manbuild_src = imp_manbuild_src;
        }
    
        @Value("#{'${imp_build_service_src}'}")
        public void setImp_build_service_src(String imp_build_service_src) {
            ProcessPathConfig.imp_build_service_src = imp_build_service_src;
        }
        @PostConstruct
        void init(){
            ProcessPathConfig.processInfoMap =  new HashMap<String, Map<String, String>>() {{
                put("imp_split_info", new HashMap<String, String>() {{
                    put("destPath", imp_split_info_src);
                }});
                put("imp_overedge_deduplicate", new HashMap<String, String>() {{
                    put("destPath", imp_overedge_deduplicate_src);
                }});
                put("imp_recognition", new HashMap<String, String>() {{
                    put("destPath", imp_recognition_src);
                }});
                put("imp_manbuild", new HashMap<String, String>() {{
                    put("destPath", imp_manbuild_src);
                }});
                put("imp_build_service", new HashMap<String, String>() {{
                    put("destPath", imp_build_service_src);
                }});
            }};
        }
    
    }
    
    

    相关文章

      网友评论

          本文标题:工具类中静态方法用到注入对象

          本文链接:https://www.haomeiwen.com/subject/hjmvhktx.html