问题描述
我有一个 springboot 项目,它引导一个从其他 jar 加载 springfactories 的过程。
@SpringBootApplication
public class MyApp{
/**
* The entry point of application.
*
* @param args the input arguments
*/
public static void main(String[] args) throws InterruptedException {
final ConfigurableApplicationContext run = SpringApplication.run(MyApp.class,args);
new FnContext((AnnotationConfigReactiveWebServerApplicationContext) run).bootstrap();
}
}
MyApp 项目有自己的 application.yaml 文件加载一些配置
FnContext 引导方法:
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
// The SpringFactoriesLoader search for function declarations in external jars spring.factories files
final List<MyFunction> functionService= SpringFactoriesLoader.loadFactories(Function.class,null);
function.forEach(k -> {
// and register functionto load additional spring configuration into the context
context.register(k.getClass());
LOG.info("function{}",k);
});
// The context is then joined to the Spring Boot run context to get Shared configuration.
context.setParent(runcontext);
// A refresh is necessary to apply registered beans
context.refresh();
问题是当我在 SpringFactoriesLoader 加载的模块之一中添加属性文件时,所有属性都被忽略,它们仅从父属性文件(来自 MyApp 项目的 properties.yaml)中获取属性
>有什么建议吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)