spring-projects / spring-integration

Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns (EIP)
http://projects.spring.io/spring-integration/
Apache License 2.0
1.54k stars 1.1k forks source link

Incompatible with Eclipse Angus Mail 2 #8616

Closed Brummolix closed 1 year ago

Brummolix commented 1 year ago

In what version(s) of Spring Integration are you seeing this issue?

6.0.0 but also 6.0.5

Describe the bug

org.springframework.integration.mail.ImapMailReceiver uses com.sun.mail.imap.IMAPFolder which is a implementation detail of the Jakarta Mail runtime. When you use Spring integration in combination with Eclipse Angus Mail (which "is the direct successor of JavaMail/JakartaMail") with version 2 or above on the classpath it will not work. Instead you get errors like:

java.lang.NoClassDefFoundError: com/sun/mail/imap/IMAPFolder

Angus Mail version 2 changes the "package name prefix from com.sun.mail to org.eclipse.angus.mail"

To Reproduce

see above or see example below

Expected behavior spring integration should

Sample

https://github.com/Brummolix/spring-integration-with-angus2

artembilan commented 1 year ago

Spring Portfolio of 6.0 generation wan never claimed to be compatible with Angus 2.0. In fact it was release just recently January, when we had Spring Integration based on Angus 1.0 last Fall.

While they claim on their site to be compatible with Jakarta EE 10, in fact it is really a breaking change to rename packages within the same Jakarta base.

I really don't like a reflection kung-fu for such a critical code path around IMAPFolder.idle(true) call, so I only can suggest to stay with Angus 1.x and we will consider to upgrade to the latest 2.0.x in the next our minor version. And that it exactly when Spring Boot 3.2 will bring us Angus Mail 2.0 dependency.

At least that's my feeling how we may deal with that breaking change. More over we are already in a GA phase for current release train. Therefore we cannot introduce a breaking change anymore.