add customize db config to README.md (#402)

This commit is contained in:
Xiaolu Dai 2019-07-27 21:45:43 +08:00 коммит произвёл GitHub
Родитель 96514d8fe3
Коммит b0f028b3fd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -62,7 +62,7 @@ This repository supports both Spring Data 1.x and 2.x. Please see [this document
return new ObjectMapper(); // Do configuration to the ObjectMapper if required return new ObjectMapper(); // Do configuration to the ObjectMapper if required
} }
``` ```
## Quick Start ## Quick Start
### Add the dependency ### Add the dependency
@ -99,6 +99,15 @@ public class AppConfiguration extends AbstractDocumentDbConfiguration {
} }
} }
``` ```
Or if you want to customize your config:
```java
public DocumentDBConfig getConfig() {
DocumentDBConfig dbConfig = DocumentDBConfig.builder(uri, key, dbName).build();
dbConfig.getConnectionPolicy().setConnectionMode(ConnectionMode.DirectHttps);
dbConfig.getConnectionPolicy().setMaxPoolSize(1000);
return dbConfig;
}
```
By default, `@EnableDocumentDbRepositories` will scan the current package for any interfaces that extend one of Spring Data's repository interfaces. Using it to annotate your Configuration class to scan a different root package by type if your project layout has multiple projects and it's not finding your repositories. By default, `@EnableDocumentDbRepositories` will scan the current package for any interfaces that extend one of Spring Data's repository interfaces. Using it to annotate your Configuration class to scan a different root package by type if your project layout has multiple projects and it's not finding your repositories.
```java ```java
@Configuration @Configuration