package com.gkhy.labRiskManage.config.file; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.InitializingBean; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.lang.reflect.Field; /** * @author :Li9527 * @date :Created in 2019-04-01 17:17 * @description:项目启动就执行的工具类 * @modified By: * @version: 1.0 */ @Slf4j //@Component public class InitConfig implements InitializingBean { @Resource FilePathConfig filePathConfig; @Override public void afterPropertiesSet() throws Exception { log.info("文件配置路径开始加载"); reflect(filePathConfig); log.info("设置模块文件路径缓存"); } public static void reflect(Object o) throws IllegalAccessException { Class cls = o.getClass(); Field[] fields = cls.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { Field f = fields[i]; f.setAccessible(true); log.info(f.getName() + "----:" + f.get(o)); } } }