From aabeaa0180d73ea09bbfa56ffee3281fdf799b71 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/generators/server/generator.js b/generators/server/generator.js index 55b3446..4d49ead 100644 --- a/generators/server/generator.js +++ b/generators/server/generator.js @@ -455,6 +455,29 @@ 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 = [ + { packageSubFolder: 'security/jwt', targetClass: 'TokenAuthenticationIT' }, + { packageSubFolder: 'security/oauth2', targetClass: 'CustomClaimConverterIT' }, + { packageSubFolder: 'service', targetClass: 'MailServiceIT' }, + { packageSubFolder: 'service', targetClass: 'UserServiceIT' }, + ]; + for (const { packageSubFolder, targetClass } of targetClasses) { + const filePath = `${srcTestJava}${packageFolder}/${packageSubFolder}/${targetClass}.java`; + if (this.existsDestination(filePath)) { + 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'), + ); + } + } + }, }); }