web3j/web3j-spring-boot-starter
关于
Spring Boot Starter for web3j
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文web3j Spring Boot Starter
Integrate web3j into your Spring Boot applications via Spring's dependency injection.
Getting started
A sample application is available here
To use, create a new Spring Boot Application, and include the following dependencies:
Maven:
<dependency>
<groupId>org.web3j</groupId>
<artifactId>web3j-spring-boot-starter</artifactId>
<version>4.0.3</version>
</dependency>
Gradle:
compile ('org.web3j:web3j-spring-boot-starter:4.0.3')
Now Spring can inject web3j instances for you where ever you need them:
@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:
# An infura endpoint
web3j.client-address = https://rinkeby.infura.io/
# Or, an IPC endpoing
web3j.client-address = /path/to/file.ipc
Admin clients
If you wish to make use of the personal module methods that are common to both
Parity and
Geth
to manage accounts, enable the admin client:
web3j.admin-client = true
Then Spring can inject admin clients:
@Autowired
private Admin admin;
HTTP client configuration
Some Ethereum operations take longer than the default HTTP timeout set by the OkHttp3 library
used by web3j. To configure those timeouts set the web3j httpTimeoutSeconds property:
web3j.httpTimeoutSeconds = 600
This sets all three OkHttp3 timeouts: connect, read, and write.
Valid values are any non-negative integer.
A value of '0' means: no timeout.
Note: This is not required for transacting with web3j.
Further information
For further information on web3j, please refer to the web3j home page.
探索相关项目
加载中…