You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2016/10/29 19:04:59 UTC
[jira] [Assigned] (CAMEL-10412) Unable to exclude
CamelAutoConfiguration in Spring Boot
[ https://issues.apache.org/jira/browse/CAMEL-10412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-10412:
-----------------------------------
Assignee: Claus Ibsen
> Unable to exclude CamelAutoConfiguration in Spring Boot
> -------------------------------------------------------
>
> Key: CAMEL-10412
> URL: https://issues.apache.org/jira/browse/CAMEL-10412
> Project: Camel
> Issue Type: Improvement
> Components: camel-spring-boot
> Affects Versions: 2.18.0
> Reporter: Minh Tran
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 2.19.0
>
>
> Prior to 2.18.0, you could exclude CamelAutoConfiguration in unit tests and no camel context would start up. This is useful for testing things in isolation that does not need camel and is a standard thing to do in Spring Boot since by default it auto configures everything it can find.
> Now with 2.18.0, there has been a lot more auto configuration classes added and required to be excluded. Virtually every *AutoConfiguration class found in camel-core-starter needs to be excluded. This is not practical to do.
> I have edited one file DirectComponentAutoConfiguration and added this line @ConditionalOnBean(CamelAutoConfiguration.class)
> and with my unit test, I can see it no longer tries to pull in that component.
> {noformat}
> @RunWith(SpringJUnit4ClassRunner.class)
> @SpringBootTest
> public class PlainTest {
> @Configuration
> @EnableAutoConfiguration(exclude = { CamelAutoConfiguration.class
> // , DirectComponentAutoConfiguration.class, DirectVmComponentAutoConfiguration.class,
> // LogComponentAutoConfiguration.class, PropertiesComponentAutoConfiguration.class, RestComponentAutoConfiguration.class,
> // SchedulerComponentAutoConfiguration.class, SedaComponentAutoConfiguration.class, StubComponentAutoConfiguration.class,
> // ValidatorComponentAutoConfiguration.class, VmComponentAutoConfiguration.class, XsltComponentAutoConfiguration.class,
> // GzipDataFormatAutoConfiguration.class, SerializationDataFormatAutoConfiguration.class, StringDataFormatAutoConfiguration.class,
> // ZipDataFormatAutoConfiguration.class, BeanLanguageAutoConfiguration.class, ConstantLanguageAutoConfiguration.class,
> // HeaderLanguageAutoConfiguration.class
> //
> })
> public static class Config {
> }
> @Test
> public void test() {
> // do something
> }
> }
> {noformat}
> Unfortunately I cannot put this into git and commit since I see at the top of the DirectComponentAutoConfiguration file
> {noformat}
> Generated by camel-package-maven-plugin - do not edit this file!
> {noformat}
> I'm not sure what to edit to get this to auto generate correctly with the changes required so I'll leave it to you guys.
> Don't forget to update the camel-core-starter/pom.xml file and add the camel-spring-boot dependency in.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)