Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reapply "catch exception in GrailsApplicationBuilder (#425)" #430

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

jamesfredley
Copy link
Contributor

This reverts commit a793484.

We will need a catch this exception given that Spring's ClassUtils.forName('com.fasterxml.jackson.databind.ObjectMapper', context.getClassLoader()) can throw an exception and https://docs.micronaut.io/4.6.5/api/io/micronaut/core/reflect/ClassUtils.html#forName(java.lang.String,java.lang.ClassLoader) did not.

try {
objectMapper = ClassUtils.forName('com.fasterxml.jackson.databind.ObjectMapper', context.getClassLoader())
} catch (ignored) {
}
if (objectMapper) {
beanExcludes.add(objectMapper)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could even be simplified to:

        try {
            Class<?> objectMapper = ClassUtils.forName('com.fasterxml.jackson.databind.ObjectMapper', context.classLoader)
            beanExcludes.add(objectMapper)
        } catch (ignored) {
            // ObjectMapper not found on classpath
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated.

@jamesfredley jamesfredley merged commit 36c53d2 into 4.0.x Sep 26, 2024
4 checks passed
@jamesfredley jamesfredley deleted the jamesfredley/fix-GrailsApplicationBuilder2 branch September 26, 2024 20:58
@matrei
Copy link
Contributor

matrei commented Sep 29, 2024

@jamesfredley I was looking at this beanExcludes variable again. It isn't used anymore, and can be removed. It was used for configuring the Micronaut context.

@codeconsole
Copy link
Contributor

#435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants