# web3j Spring Boot Starter
[![Build Status](https://travis-ci.org/web3j/web3j-spring-boot-starter.svg?branch=master)](https://travis-ci.org/web3j/web3j-spring-boot-starter)
Integrate web3j into your Spring Boot applications via Spring's dependency injection.
## 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>4.0.3</version>
</dependency>
```
Gradle:
```groovy
compile ('org.web3j:web3j-spring-boot-starter:4.0.3')
```
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://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](https://github.com/ethcore/parity/wiki/JSONRPC-personal-module) and
[Geth](https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal)
to manage accounts, enable the admin client:
```properties
web3j.admin-client = true
```
Then Spring can inject admin clients:
```java
@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:
```properties
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](https://web3j.io).
没有合适的资源?快使用搜索试试~ 我知道了~
web3j-spring-boot-starter:用于web3j的Spring Boot Starter
共18个文件
java:6个
gradle:2个
properties:2个
需积分: 44 8 下载量 103 浏览量
2021-01-30
02:16:43
上传
评论
收藏 70KB ZIP 举报
温馨提示
web3j Spring Boot Starter 通过Spring的依赖注入将web3j集成到您的Spring Boot应用程序中。 入门 提供示例应用程序 要使用,请创建一个新的 ,并包括以下依赖项: 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 ' ) 现在,Spring可以在任何需要的地方为您注入web3j实例: @Autowired private Web3j web3j; 如果要通过HTTP连接到默认URL 则不需要其他配置。 否则,只需在应用程序属性中添加端点的地址: # An infura endpoint web3j.client-addres
资源详情
资源评论
资源推荐
收起资源包目录
web3j-spring-boot-starter-master.zip (18个子文件)
web3j-spring-boot-starter-master
.gitignore 637B
gradle
wrapper
gradle-wrapper.jar 55KB
gradle-wrapper.properties 234B
README.md 2KB
build.gradle 9KB
.gitlab-ci.yml 736B
gradlew.bat 2KB
gradlew 5KB
src
test
resources
application.properties 68B
java
org
web3j
spring
autoconfigure
context
SpringApplicationTest.java 515B
Web3jAutoConfigurationTest.java 5KB
Web3jHealthIndicatorTest.java 4KB
main
resources
META-INF
spring.factories 116B
java
org
web3j
spring
actuate
Web3jHealthIndicator.java 2KB
autoconfigure
Web3jProperties.java 1KB
Web3jAutoConfiguration.java 4KB
.travis.yml 629B
settings.gradle 233B
共 18 条
- 1
Dilwanga
- 粉丝: 23
- 资源: 4682
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 最入门的爬虫代码 python.docx
- 爬虫零基础入门-爬取天气预报.pdf
- 最通俗易懂的 MongoDB 非结构化文档存储数据库教程.zip
- 以mongodb为数据库的订单物流小项目.zip
- 腾讯云-mongodb数据库, 项目部署.zip
- 腾讯 APIJSON 的 MongoDB 数据库插件.zip
- 理解非关系型数据库和关系型数据库的区别.zip
- 操作简单的Mongodb网页web管理工具,基于Spring Boot2.0支持mongodb集群.zip
- tms-mongodb-web,提供访问mongodb数据的REST API和可灵活扩展的mongodb web 客户端.zip
- SpringBoot整合mongodb学习MongoTemplate和MongoRepository两种方式CRUD使用.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0