@DisabledInAotMode

@DisabledInAotMode 表示带注解的测试类在 Spring AOT(ahead-of-time)模式下被禁用,这意味着测试类的 ApplicationContext 在构建时不会进行 AOT 优化处理。

如果一个测试类被 @DisabledInAotMode 注解,那么所有指定配置以加载相同 ApplicationContext 的其他测试类也必须被 @DisabledInAotMode 注解。如果未能注解所有这些测试类,将导致在构建时或运行时抛出异常。

当与基于 JUnit Jupiter 的测试一起使用时,@DisabledInAotMode 还表示在 Spring AOT 模式下运行测试套件时,带注解的测试类或测试方法被禁用。当应用于类级别时,该类中的所有测试方法都将被禁用。从这个意义上讲,@DisabledInAotMode 的语义与 JUnit Jupiter 的 @DisabledInNativeImage 注解类似。

有关集成测试特有的 AOT 支持的详细信息,请参阅测试的预编译支持

© . This site is unofficial and not affiliated with VMware.