简体   繁体   English

测试 micronaut 是否缺少运行时依赖项

[英]test for micronaut missing runtime dependencies

I've had a bug appear a few times where micronaut is missing a dependency at runtime, this only shows up when the app is running.我有几次出现错误,其中 micronaut 在运行时缺少依赖项,这仅在应用程序运行时显示。 Is there a way to test for these missing dependencies in a unit test?有没有办法在单元测试中测试这些缺失的依赖项? I would basically need to walk all code paths in order to activate the JVM looking for classes I think.我基本上需要遍历所有代码路径才能激活 JVM 寻找我认为的类。

Is there a way to test for these missing dependencies in a unit test?有没有办法在单元测试中测试这些缺失的依赖项?

There will be for some specific kinds of dependencies, but not one in general no.会有一些特定类型的依赖关系,但一般不会有。

I would basically need to walk all code paths in order to activate the JVM looking for classes I think.我基本上需要遍历所有代码路径才能激活 JVM 寻找我认为的类。

That would not necessarily be sufficient.这不一定是足够的。 There are a lot of things related to required dependencies that can be affected by the runtime environment (like OS environment variables, etc.).有很多与所需的依赖项相关的东西可能会受到运行时环境的影响(比如 OS 环境变量等)。 The dependencies that you could tease out by walking code paths mostly (not entirely) will be identified at compile time.您可以通过遍历代码路径大部分(不是全部)梳理出的依赖项将在编译时识别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM