Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ice09/jlibra-spring-boot-starter
Spring Boot Starter for jlibra usage, see http://blockchainers.org/index.php/2019/07/22/jlibra-connecting-libra-to-java/
https://github.com/ice09/jlibra-spring-boot-starter
Last synced: 3 months ago
JSON representation
Spring Boot Starter for jlibra usage, see http://blockchainers.org/index.php/2019/07/22/jlibra-connecting-libra-to-java/
- Host: GitHub
- URL: https://github.com/ice09/jlibra-spring-boot-starter
- Owner: ice09
- Created: 2019-07-22T21:44:54.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T14:49:19.000Z (about 4 years ago)
- Last Synced: 2024-06-26T03:34:27.681Z (5 months ago)
- Language: Java
- Size: 33.2 KB
- Stars: 4
- Watchers: 0
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-libra - jlibra-spring-boot-starter - Spring Boot Starter project based on jlibra. (Java)
README
# jlibra Spring Boot Starter
Integrate [jlibra](https://github.com/ketola/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](https://github.com/web3j/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](https://spring.io/guides/gs/spring-boot/), and
include the following dependencies:Maven:
```xml
dev.jlibra
jlibra-spring-boot-starter
1.0.0```
Gradle:
```groovy
compile ('dev.jlibra:jlibra-spring-boot-starter:1.0.0')
```Now Spring can inject jlibra instances for you where ever you need them:
```java
@Autowired
private JLibra jlibra;
```The `JLibra` class is initialized with the values configured according to [externalized configuration in Spring](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config).
For example, add the configuration values to a file `application.properties` next to the runnable jar.```properties
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.
* AccountStateQuery
* PeerToPeerTransferThese 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 peerToPeerTransferpublic void transfer(...) {
peerToPeerTransfer.transfer(...);
}
```
## Further informationFor further information on jlibra, please refer to the [jlibra GitHub](https://github.com/ketola/jlibra).