Skip to content

Commit

Permalink
Merge pull request #435 from codeconsole/4.0.x-remove-auto
Browse files Browse the repository at this point in the history
GrailsAutoConfiguration registers conflicting grailsApplicationPostPr…
  • Loading branch information
codeconsole committed Sep 29, 2024
2 parents 36c53d2 + 9ebcf46 commit 5e8f581
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,11 @@ class GrailsApplicationBuilder {
} else {
context = (ConfigurableApplicationContext) ClassUtils.forName('org.springframework.context.annotation.AnnotationConfigApplicationContext').getDeclaredConstructor().newInstance()
}
((AnnotationConfigRegistry) context).register(GrailsAutoConfiguration, CoreConfiguration, CodecsConfiguration, DataBindingConfiguration, MimeTypesConfiguration)
((AnnotationConfigRegistry) context).register(CoreConfiguration, CodecsConfiguration, DataBindingConfiguration, MimeTypesConfiguration)

def applicationClassLoader = this.class.classLoader
def configuredEnvironment = context.getEnvironment()
def beanFactory = context.getBeanFactory()
def beanExcludes = [ConversionService, Environment, PropertyResolver, ConfigurableEnvironment]

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

(beanFactory as DefaultListableBeanFactory).with {
setAllowBeanDefinitionOverriding(true)
setAllowCircularReferences(true)
Expand Down

0 comments on commit 5e8f581

Please sign in to comment.