citrusframework / citrus

Framework for automated integration tests with focus on messaging integration
https://citrusframework.org
Apache License 2.0
456 stars 134 forks source link

CitrusSpringConfig TypeConverter clashing with Camel TypeConverter #927

Closed ClemensKrug closed 1 year ago

ClemensKrug commented 1 year ago

Citrus Version 3.3.0

Camel Version: 3.18.3

Expected behavior I can execute Tests which are annotated with @SpringBootTest, @CitrusSpringSupport and @ContextConfiguration(classes = {CitrusConfig.class, CitrusSpringConfig.class})

Actual behavior The ApplicationContext fails to load because the Citrus TypeConverter defined in CitrusSpringConfig.class clashes with the TypeConverter defined in org/apache/camel/spring/boot/TypeConversionConfiguration.class. This leads to a BeanDefinitionOverrideException. Allowing bean overriding does not solve the Problem either, but leads to different errors.

Workaround If I copy the CitrusSpringConfiguration.class and give the TypeConverter Bean a different name, everything works as expected.

Test case sample @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {Application.class} ) @CitrusSpringSupport @ContextConfiguration(classes = { CitrusSpringConfig.class, CitrusConfig.class}) public class RouteUnitTest {

@CitrusTest
@Test
public void getPerson(@CitrusResource TestActionRunner test) throws Exception {
    System.out.println("Test");
}

}

christophd commented 1 year ago

Hi, has already been fixed in v3.4.0 (see https://github.com/citrusframework/citrus/commit/571f629ba3abd084886a970937ee9a22399877c6)

Please verify with Citrus 3.4.0

ClemensKrug commented 1 year ago

Hi Christoph

Super quick rely! Cheers!

My bad, that issue popped up in my search but I didn't look at it because of the 'chore' label. With 3.4. it does indeed work!

Much appreciated!