从Java应用程序推断I / O端点

问题描述

我想创建一个小型应用程序,该程序可以解析Java源代码以查看应用程序中所有可能的I / O端点(以及它所带的对象),以便我可以映射一些简单的微服务架构图(例如Rabbit端点和哪个微服务正在通过这个观点与其他人交流。

是否存在一些只能使用静态代码分析的解决方案?我知道有很多作为Java代理工作的应用程序,它们基本上可以拦截数据通信以创建微服务之间的通信映射。

如果没有,是否有简单的方法可以对以下代码进行静态分析:

//SomeComponent - entry point
public class SomeComponent {

  public static void main(String[] args) throws Exception {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(SomeConfig.class);
    context.registerShutdownHook();
    context.refresh();
  }
}

//SomeConfig.java
@Configuration
@Import({
  RabbitConfig.class
})
public class SomeConfig {
...
}

//RabbitConfig.java
@Configuration
public class RabbitConfig {
  @Bean
  public SimpleMessageListenerContainer heartBeatListener(
      @Qualifier("aliveQueue") Queue aliveQueue,ConnectionFactory connectionFactory) {
    SimpleMessageListenerContainer container = rabbitConfig.createSimpleMessageListenerContainer();
    container.setQueues(aliveQueue);
    ...
  }

  @Bean
  public Queue aliveQueue() {
    String queueName = "alivecomponent." + java.util.UUID.randomUUID();
    Queue q = new Queue(queueName,false,null);
    return q;
  }
}

在这里main()方法是应用程序的入口点。我需要一些可以从此入口点分析所有可访问代码的lib(即SomeConfig.java和RabbitConfig.java),因此以后我可以查询该分析器以“为我提供SimpleMessageListenerContainer的所有可能对象及其{{ 1}}属性

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)