Sunday 1 April 2018

Apache Camel, Spring, Spring Data and Hibernate Maven Dependencies

I was working on an integration framework for a mobile application using Apache Camel and Spring. The application had to connect to a legacy back end system's RDBMS application and to make life easier for my development team I opted to leverage Spring Data JPA for the RDBMS (with Hibernate as the JPA provider) and Spring Data Mongo for connecting to MongoDB.

The problem was with managing the dependencies for Apache Camel, Spring, Spring Data JPA, Spring Data MongoDB and Hibernate - how to get all this stuff working together?!?

I managed to figure this out, starting with the Apache Camel BOM and built things up from there - you can see the Maven dependencies below;

<dependencyManagement>
<dependencies>
 <!-- Camel BOM -->
 <dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-parent</artifactId>
  <version>2.20.2</version>
  <scope>import</scope>
  <type>pom</type>
 </dependency>
</dependencies>
</dependencyManagement>


<dependencies>
<dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-core</artifactId>
</dependency>

<dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-spring</artifactId>
</dependency>

<dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-jackson</artifactId>
</dependency>

<dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-spring-javaconfig</artifactId>
</dependency>

<dependency>
 <groupId>org.springframework</groupId>
 <artifactId>spring-orm</artifactId>
</dependency>

<dependency>
 <groupId>org.hibernate</groupId>
 <artifactId>hibernate-core</artifactId>
 <version>4.3.11.Final</version>
</dependency>

<dependency>
 <groupId>org.hibernate</groupId>
 <artifactId>hibernate-entitymanager</artifactId>
 <version>4.3.11.Final</version>
</dependency>

<dependency>
 <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-jpa</artifactId>
 <version>1.11.10.RELEASE</version>
</dependency>

<dependency>
 <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-mongodb</artifactId>
 <version>1.10.10.RELEASE</version>
</dependency>

<dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-test</artifactId>
</dependency>

<dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-test-spring</artifactId>
</dependency>

<!-- logging -->
<dependency>
 <groupId>org.apache.logging.log4j</groupId>
 <artifactId>log4j-api</artifactId>
</dependency>
<dependency>
 <groupId>org.apache.logging.log4j</groupId>
 <artifactId>log4j-core</artifactId>
</dependency>
<dependency>
 <groupId>org.apache.logging.log4j</groupId>
 <artifactId>log4j-slf4j-impl</artifactId>
</dependency>

<!-- MongoDB driver -->
<dependency>
 <groupId>org.mongodb</groupId>
 <artifactId>mongo-java-driver</artifactId>
 <version>3.6.3</version>
</dependency>
</dependencies>


I have omitted the Oracle RDBMS dependency, but that shouldn't cause anyone any problems if you're trying to get this stuff working together!


No comments:

Post a Comment