java - Camel Spring JavaConfig Maven-Camel-Plugin without any xml -
how can setup camel projects rely on spring dependency injection system while being xml free using maven camel run plugin. have tried ton of configurations, still seem stuck "shell context" file imports java configuration file. there anyway rid of this? note: on latest camel version of 2.17.1
camel route
@component public class testroute extends springroutebuilder { @override public void configure() throws exception { from("timer://foo?repeatcount=1") .log("hello world"); } }
java config
@configuration @componentscan("com.mcf.xml.free.route") public class routejavaconfig extends camelconfiguration { }
maven camel plugin
<plugin> <groupid>org.apache.camel</groupid> <artifactid>camel-maven-plugin</artifactid> <version>${camel.version}</version> <configuration> <configclasses>com.mcf.xml.free.config.routejavaconfig</configclasses> </configuration> </plugin>
plugin context lets work want rid of.
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:annotation-config/> <bean class="com.mcf.xml.free.config.routejavaconfig"/> </beans>
is there way have maven camel run plugin accept java config instead of spring context file? haven't tested yet, if removing file going cause issue deploying apache karaf there way have configured use java config well?
you can start spring java config application using main class create yourself, , use java-maven-exec plugin run it. example has no xml file @ all.
there example part of apache camel at: https://github.com/apache/camel/tree/master/examples/camel-example-spring-javaconfig
Comments
Post a Comment