> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/iv.-spring-boot-features/30.-working-with-nosql-technologies/30.10-influxdb/30.10.1-connecting-to-influxdb.md).

# 30.10.1 连接InfluxDB

只要`influxdb-java`客户端在类路径下，而且设置了数据库的url，Spring Boot就能自动配置InfluxDB实例。如下所示：

```
spring.influx.url=http://172.0.0.1:8086
```

如果连接InfluxDB需要用户名和密码，你可以相应地设置`spring.influx.user`和`spring.influx.password`。

InfluxDB依赖OkHttp。如果你需要调整http客户端`InfluxDB`在幕后使用，你可以注册一个`OkHttpClient.Builder` bean。
