Home

Awesome

jlibra Spring Boot Starter

Integrate jlibra into your Spring Boot applications via Spring's dependency injection and Spring Boots external configuration and Actuator functionality.
This is basically a copy with search/replace of web3j-spring-boot-starter

Usage

The jlibra-spring-boot-starter project enables other (Spring Boot) applications, like web applications, shell applications, and more, to use the jlibra library.

As a sample for this usage the java-libra-cli application was created.

To use, create a new Spring Boot Application, and include the following dependencies:

Maven:

<dependency>
    <groupId>dev.jlibra</groupId>
    <artifactId>jlibra-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle:

compile ('dev.jlibra:jlibra-spring-boot-starter:1.0.0')

Now Spring can inject jlibra instances for you where ever you need them:

@Autowired
private JLibra jlibra;

The JLibra class is initialized with the values configured according to externalized configuration in Spring.
For example, add the configuration values to a file application.properties next to the runnable jar.

jlibra.service-url=ad.testnet.libra.org
jlibra.service-port=8000
jlibra.faucet-url=faucet.testnet.libra.org
jlibra.faucet-port=80
jlibra.gas-unit-price=5
jlibra.max-gas-amount=600000

Predefined Actions

There are currently two predefined actions in the action package.

These actions can just be @Autowired and are preconfigured as well, so you don't have to deal with jlibra directly.
This is WIP and other actions will be added soon.

@Autowired
private PeerToPeerTransfer peerToPeerTransfer

public void transfer(...) {
	peerToPeerTransfer.transfer(...);
}

Further information

For further information on jlibra, please refer to the jlibra GitHub.