Deploying Hyperon

Bootstrap Hyperon Runtime with Spring Boot Starter (since version 2.1.0)

Prerequisites

  • Java 11
  • Maven 3.x
  • Spring Boot

Maven configuration

Apart from standard spring bootdependencies, you need to include hyperon-runtime-spring-boot-starter dependency, available in Maven Central.

Add hyperon-runtime-spring-boot-starter dependency to pom.xml file:

 
<dependency>
		<groupId>pl.decerto</groupId>
		<artifactId>hyperon-runtime-spring-boot-starter</artifactId>
		<version>${hyperon-runtime.version}</version>
</dependency> 

Another needed dependency is the JDBC driver to the database of choice, e.g., h2, oracle, mssql, postgresql:

 
<dependency>
		<groupId>com.h2database</groupId>
		<artifactId>h2</artifactId>
		<version>${h2-database.version}</version>
</dependency>

Properties

With the above setup, all the configuration that is needed is application.properties file with database properties:

 
hyperon.database.url=<jdbc_url>
hyperon.database.username=<username>
hyperon.database.password=<password>

If required properties are not available, hyperon-runtime-spring-boot-starter will return an adequate message

To configure external sources, you have toset comma separated list of external sources names and connection propertiesfor each of them. You can do it by using the properties below.

 
hyperon.runtime.external-datasource.sql.names=postgres,h2

hyperon.runtime.external-datasource.sql.postgres.url=
hyperon.runtime.external-datasource.sql.postgres.username=
hyperon.runtime.external-datasource.sql.postgres.password=

hyperon.runtime.external-datasource.sql.h2.url=
hyperon.runtime.external-datasource.sql.h2.username=
hyperon.runtime.external-datasource.sql.h2.password=

Using auto-configured HyperonEngine

After successfully configuring properties while starting the application, spring will create HyperonEngine bean available in the spring application context, which can then be injected anywhere:

 
@Component
public class HyperonClient {
	@Autowired
	private HyperonEngine engine;
}

Overriding default configuration

To override default auto-configuration, you need to define HyperonEngine bean in the @Configuration class:

 
@Bean
public HyperonEngine hyperonEngine() {
	HyperonEngineFactory factory = new HyperonEngineFactory();
	return factory.create();
}

Existing auto-configured DataSource and HyperonRuntimeProperties can be used simply by injecting them:

 
public HyperonEnginehyperonEngine(
	HyperonRuntimeProperties properties,
	@Qualifier("hyperonDataSource") DataSource dataSource
) {}

Disabling Hyperon

If you want to disable hyperon temporarily for some reason, you can do it with property hyperon.runtime.enabled set to false:

 
hyperon.runtime.enabled=false