Skip to content

Commit

Permalink
disable some IT classes in AOT mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hide212131 committed Dec 18, 2023
1 parent 2b596fb commit 9ec36ea
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions generators/server/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
`@DisabledInAotMode // workaround for https://github.com/spring-projects/spring-boot/issues/32195\nclass ${targetClass}`,
)
.replace(/(import .+;)\n/, '$1\nimport org.springframework.test.context.aot.DisabledInAotMode;\n'),
);
}
}
},
});
}

Expand Down

0 comments on commit 9ec36ea

Please sign in to comment.