Hi folks,
There is an issue when running tests for a SpringBoot application that uses
camel-rest.
When there are multiple tests that use a different configuration (e.g.,
different properties), we run into this error:
Caused by:
jakarta.servlet.ServletException: Duplicate ServletName
detected: CamelServlet. Existing: CamelHttpTransportServlet[name=CamelServlet]
This: CamelHttpTransportServlet[name=CamelServlet]. Its advised to use unique
ServletName per Camel application.
at
app//org.apache.camel.component.servlet.CamelHttpTransportServlet.init(CamelHttpTransportServlet.java:68)
I have created a standalone example to demonstrate the issue:
https://github.com/abendt/camel-rest
To reproduce:
./gradlew -i test
The project contains two tests with different configurations (one has an
additional active profile).
I would expect the build to pass; however, it fails with the mentioned
exception.
As a workaround, it's possible to add @DirtiesContext. However, this hurts test
performance and should be avoided if possible.
Am i missing something or is this a current limitation of camel-rest?
thanks,
Alphonse