Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Added main project documentation.
2. Updated unit tests.
- Loading branch information
Showing
3 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,73 @@ | ||
# web3j Spring Boot Starter | ||
|
||
Integrate web3j into your Spring Boot applications. | ||
Integrate web3j into your Spring Boot applications via Spring's dependency injection. | ||
|
||
Groovy: | ||
|
||
```groovy | ||
## Getting started | ||
|
||
``` | ||
A sample application is available [here](https://github.com/web3j/examples/tree/master/spring-boot) | ||
|
||
To use, create a new [Spring Boot Application](https://spring.io/guides/gs/spring-boot/), and | ||
include the following dependencies: | ||
|
||
Maven: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>org.web3j</groupId> | ||
<artifactId>web3j-spring-boot-starter</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
``` | ||
|
||
Gradle: | ||
|
||
```groovy | ||
compile ('org.web3j:web3j-spring-boot-starter:1.0.0') | ||
``` | ||
|
||
Now Spring can inject web3j instances for you where ever you need them: | ||
|
||
```java | ||
@Autowired | ||
private Web3j web3j; | ||
``` | ||
|
||
No additional configuration is required if you want to connect via HTTP to the default URL | ||
http://localhost:8545. | ||
|
||
Otherwise simply add the address of the endpoint in your application properties: | ||
|
||
```properties | ||
# An infura endpoint | ||
web3j.client-address = https://morden.infura.io/ | ||
|
||
# Or, an IPC endpoing | ||
web3j.client-address = /path/to/file.ipc | ||
``` | ||
|
||
|
||
## Admin clients | ||
|
||
If you wish to make use of the | ||
[Parity](https://github.com/ethcore/parity/wiki/JSONRPC-personal-module) or | ||
[Geth](https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal) personal modules | ||
to manage accounts, enable the admin client: | ||
|
||
```properties | ||
web3j.admin-client = true | ||
``` | ||
|
||
Then Spring can inject admin clients: | ||
|
||
```java | ||
@Autowired | ||
private Parity parity; | ||
``` | ||
|
||
**Note**: This is not required for transacting with web3j. | ||
|
||
|
||
## Further information | ||
|
||
For further information on web3j, please refer to the [web3j home page](https://web3j.io). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
rootProject.name = 'spring-boot-starter' | ||
// This should not be shortened | ||
// See http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-auto-configuration.html#boot-features-custom-starter-naming | ||
rootProject.name = 'web3j-spring-boot-starter' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters