Maven and Spring

Maven modules

OpenHub framework consists of the following Maven modules:

  • common: module contains useful functions for other modules
  • core-api: user API for writing new routes with OpenHub framework
  • core-spi: interface for internal use in OpenHub framework components
  • core: module with core functionality, implements API and SPI interfaces 
  • test: module with basic configuration and parent classes for unit tests
  • components: OpenHub framework components
  • examples: examples how to use OpenHub framework
  • web: configures OpenHub as web application, "backend" for admin-console client with REST interface implementation
  • admin-console: admin GUI client written in React
  • war: WAR build

Spring contexts

OpenHub framework uses and is configured by Spring framework.

There are the following Spring contexts hierarchy:

  • root application context (Apache Camel, database, Spring Web Services - MessageDispatcherServlet and Spring Security) + web-admin-mvc (Spring Web MVC context for admin GUI)
  • extension child context

Spring profiles

OpenHub framework uses Spring profiles to simplify configuration for different target environments (profiles ar defined in org.openhubframework.openhub.common.Profiles):

  • dev: profile for development environment; this profile has disabled several functions which are enabled in production, e.g. scheduled tasks for asynchronous messages
  • test: profile is activated for unit testing
  • prod: profile for production environment

Next Spring profiles are used for switching between databases:

  • h2 (default): database H2 in embedded in-memory mode, more information in chapter about H2 database
  • postgresql: profile for PostgreSQL database

There is profile cluster for cluster environment. 

Apart from these profiles it's good practice to define Spring profile for each module and use it for configuration all beans in this module.

Defaults Spring profiles are set in, it's possible to override them by Environment parameter

Maven profiles

There are also Maven profiles which correspond to Spring profiles. Maven profiles solve dependency to third-party libraries for specific target environment and settings of folders, logs etc. See pom.xml in module web-admin.

  • esb.psSqlb - profile for PostgreSQL database
  • - profile for PostgreSQL database but PostgreSQL libraries are "provided"
  • esb.executable - profile used for packaging OpenHub to support standalone running
  • full-build - profile which is activated by default (to deactivate use skipDefault property), can be deactivated for example to exclude admin-console maven module from build (faster build).
  • full-clean - profile which is activated by default (to deactivate use skipDefault property), it can be deactivated for example if cached admin-console maven module libs (npm packages and so on) should be used (=> faster build)


OpenHub framework compilation with Maven for local use (=dev) with PostgreSQL database:

Application server starts with the following system parameter