apache / apache/grails-core

Can't run app using Grails 6 and Spring Integration XML Gateway definition

Open
#13,982 3 comments 0 reactions 0 assignees View on GitHub
info: example-attached info: workaround available type: bug
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Expected Behavior

Gateway definition in xml works correctly like in spring boot 2 and spring integration 5.

### Actual Behaviour

App throws this error during startup:
```
The provided 'BeanDefinitionRegistry' must be an instance of 'ConfigurableBeanFactory' or 'ConfigurableApplicationContext', but given is: class org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry
```

### Steps To Reproduce

1. grails create-app
2. create TestInterface with `void send(Message message)`
3. add resources.xml with `int:gateway` definition in it, referring to testInterface
4. ./gradlew bootRun

Commenting out the gateway definition in resources.xml causes the app to startup fine.

A workaround for this seems to be removing the gateway xml definition and defining the gateway interface like this instead:

```groovy
import org.springframework.integration.annotation.Gateway
import org.springframework.integration.annotation.MessagingGateway
import org.springframework.messaging.Message

@MessagingGateway
interface TestInterface {
@Gateway
void send(Message message)
}

```

This isn't the best workaround for projects that have thousands of lines of spring integration xml definition.

### Environment Information

- Grails 6.2.3
- Spring Integration 5.5.20
- Operating System - tested on both Mac and Linux
- JDK - 17.0.3
- Groovy 3.0.13
- Gradle 7.6.4

### Example Application

https://github.com/ice1080/grails-spring-integration-xml

### Version

6.2.3

Contributor guide

Open the contributing guide

Research direction

Start with the linked example application and its resources.xml gateway definition, then run ./gradlew bootRun to reproduce the startup failure. Trace how the XML gateway is loaded alongside the TestInterface and investigate the BeanDefinitionRegistry error; done means the application starts with the XML gateway definition working.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.