|
@@ -0,0 +1,30 @@
|
|
|
+package cn.com.qmth.examcloud.exchange.config;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.context.ApplicationListener;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.context.event.ContextRefreshedEvent;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.commons.base.util.PathUtil;
|
|
|
+import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 属性配置
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @date 2018年6月21日
|
|
|
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+public class PropertiesConfig implements ApplicationListener<ContextRefreshedEvent> {
|
|
|
+
|
|
|
+ @Value("${spring.profiles.active}")
|
|
|
+ private String springProfilesActive;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onApplicationEvent(ContextRefreshedEvent event) {
|
|
|
+ String resourceName = "application-" + springProfilesActive + ".properties";
|
|
|
+ PropertiesUtil.configureAndWatch(PathUtil.getResoucePath(resourceName));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|