Skip to content

Conversation

@cppwfs
Copy link
Contributor

@cppwfs cppwfs commented Nov 18, 2025

This commit introduces a new Hello World sample specifically designed for Groovy developers. The sample demonstrates basic Spring Integration concepts using Groovy DSL and provides two runnable applications.

Changes include:

  • Add helloworld-groovy project with Groovy DSL configuration
  • Implement HelloWorldApp and PollerApp examples
  • Configure Groovy dependencies and spring-integration-groovy module
  • Add runHelloWorldApp and runPollerApp Gradle tasks for execution
  • Update developer information in build.gradle POM configuration

This commit introduces a new Hello World sample specifically designed
for Groovy developers. The sample demonstrates basic Spring Integration
concepts using Groovy DSL and provides two runnable applications.

Changes include:
- Add `helloworld-groovy` project with Groovy DSL configuration
- Implement HelloWorldApp and PollerApp examples
- Configure Groovy dependencies and spring-integration-groovy module
- Add runHelloWorldApp and runPollerApp Gradle tasks for execution
- Update developer information in build.gradle POM configuration
@cppwfs cppwfs requested a review from artembilan November 18, 2025 16:23
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

Some minor nit-picks.
Thank you!

}

@Bean
Executor executor() {
Copy link
Member

Choose a reason for hiding this comment

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

This bean looks like out of use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added it blindly, because it was in the original. Will remove.

{ e -> e.poller(Pollers.fixedDelay(20000).maxMessagesPerPoll(2)) })
{
log LoggingHandler.Level.INFO, 'org.springframework.integration.samples.helloworld'
channel { queue 'loggerChannel' }
Copy link
Member

Choose a reason for hiding this comment

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

You already have logged the data.
Perhaps nullChannel() is what we need in the end.

}

@Bean
IntegrationFlow helloWorldFlow(@Qualifier('inputChannel') MessageChannel input,
Copy link
Member

Choose a reason for hiding this comment

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

I think Groovy is smart enough to let us to not specify a return type on bean methods.

build.gradle Outdated
roles = ['project founder and lead emeritus']
}
developer {
id = 'glennrenfro'
Copy link
Member

Choose a reason for hiding this comment

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

I think this is supposed to be your GH account.

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

Forgot to mention: we need some tests to be sure that our Groovy code is working.


@BeforeEach
void setup() {
context = new AnnotationConfigApplicationContext(HelloWorldConfig)
Copy link
Member

Choose a reason for hiding this comment

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

I believe @SpringJUnitConfig works well with Groovy, too.
We don't need these pair of infra methods.
You can point to that HelloWorldConfig from the annotation.

Copy link
Member

Choose a reason for hiding this comment

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

This was not addressed

inputChannel.send(new GenericMessage<String>('World'))
def message = outputChannel.receive(1000)
assertNotNull(message, 'Message should not be null')
assertEquals('Hello World', message.payload)
Copy link
Member

Choose a reason for hiding this comment

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

We prefer AssertJ instead of JUnit native assertions.

loggerContext.getRootLogger().addAppender(listAppender)
loggerContext.updateLoggers()

context = new AnnotationConfigApplicationContext(PollerConfig)
Copy link
Member

Choose a reason for hiding this comment

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

Same here about @SpringJUnitConfig.
If we go a ListAppender way, then it might be better to configure it only once for all the tests using @BeforeAll/@AfterAll.
Otherwise this test class share some bad practice with Spring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

spring-integration-core can be removed as this project picks it up from spring-integration-groovy'. However, log4j-core` is only declared in projects that need it.

* Update PR per code review comments.
* Remove dependencies that are picked up transitively
* Update JUnit version

@BeforeEach
void setup() {
context = new AnnotationConfigApplicationContext(HelloWorldConfig)
Copy link
Member

Choose a reason for hiding this comment

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

This was not addressed

@artembilan artembilan merged commit f513738 into spring-projects:main Nov 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants