From 60b22f471c2a655de648926b888e4f36d6cb038c Mon Sep 17 00:00:00 2001 From: Hideyuki Kagami Date: Tue, 19 Dec 2023 01:20:41 +0900 Subject: [PATCH] disable some IT classes in AOT mode --- generators/server/generator.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/generators/server/generator.js b/generators/server/generator.js index 55b3446..ae9dc67 100644 --- a/generators/server/generator.js +++ b/generators/server/generator.js @@ -455,6 +455,22 @@ class `, content.replace('start_period: 10s', 'start_period: 30s').replace('retries: 20', 'retries: 40'), ); }, + + // workaround for https://github.com/spring-projects/spring-boot/issues/32195 + disableMockBean({ application: { srcTestJava, packageFolder } }) { + const targetClasses = ['UserServiceIT', 'MailServiceIT']; + for (const targetClass of targetClasses) { + const filePath = `${srcTestJava}${packageFolder}/service/${targetClass}.java`; + this.editFile(filePath, content => + content + .replace( + `class ${targetClass}`, + `// workaround for https://github.com/spring-projects/spring-boot/issues/32195\n@DisabledInAotMode\nclass ${targetClass}`, + ) + .replace(/(import .+;)\n/, '$1\nimport org.springframework.test.context.aot.DisabledInAotMode;\n'), + ); + } + }, }); }