Commit b2d52d0d by Nepxion

增加扩展设置元数据的功能

parent 1b71cc3f
package com.nepxion.discovery.plugin.example.service.context;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
// 通过如下方式,可以代替在配置文件里面配置元数据,格式为ext.xxx。例如,如果version希望通过git插件获取到最后一次提交编号,可以动态在这里进行解析并放入
public class MyApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
if (applicationContext instanceof AnnotationConfigServletWebServerApplicationContext) {
// System.setProperty("ext.group", "myGroup");
// System.setProperty("ext.version", "8888");
// System.setProperty("ext.region", "myRegion");
}
}
}
\ No newline at end of file
org.springframework.context.ApplicationContextInitializer=\
com.nepxion.discovery.plugin.example.service.context.MyApplicationContextInitializer
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment