Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-thorel-of authored Jan 17, 2024
1 parent 099ffc5 commit 8fffa1a
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ and provides class and annotation to improve your developer experience using Pos
Add the following dependency to your Maven project:

```xml

<dependency>
<groupId>fr.ouestfrance.querydsl</groupId>
<artifactId>querydsl-postgrest</artifactId>
Expand All @@ -51,7 +50,16 @@ implementing `PostgrestClient` interface.
You can also specify authenticators, interceptors (retry, transform) and every configuration (timeout, default headers,
cookies, ...) you need to deploy.

**Webclient configuration example**
#### WebClient configuration example

Add the dependency :
```xml
<dependency>
<groupId>fr.ouestfrance.querydsl</groupId>
<artifactId>querydsl-postgrest-webclient-adapter</artifactId>
<version>${querydsl-postgrest.version}</version>
</dependency>
```

```java
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -77,6 +85,42 @@ public class PostgrestConfiguration {
}
```

#### RestTemplate configuration example

Add the dependency :
```xml
<dependency>
<groupId>fr.ouestfrance.querydsl</groupId>
<artifactId>querydsl-postgrest-resttemplate-adapter</artifactId>
<version>${querydsl-postgrest.version}</version>
</dependency>
```

```java
import com.fasterxml.jackson.databind.ObjectMapper;
import fr.ouestfrance.querydsl.postgrest.PostgrestClient;
import fr.ouestfrance.querydsl.postgrest.PostgrestRestTemplate;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.DefaultUriBuilderFactory;

@Configuration
public class PostgrestConfiguration {

@Bean
public PostgrestClient podstgrestClient() {
String serviceUrl = "http://localhost:9000";
RestTemplate restTemplate = new RestTemplate();
restTemplate.setUriTemplateHandler(new DefaultUriBuilderFactory(serviceUrl));
restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault()));
return PostgrestRestTemplate.of(webclient);
}
}
```

### Create your first repository

#### Specify your first search criteria
Expand Down Expand Up @@ -334,4 +378,4 @@ The QueryDSL is licensed under [MIT License](https://opensource.org/license/mit/

[sonar-image]: https://sonarcloud.io/api/project_badges/measure?project=Ouest-France_querydsl-postgrest&metric=alert_status

[sonar-url]: https://sonarcloud.io/summary/new_code?id=Ouest-France_querydsl-postgrest
[sonar-url]: https://sonarcloud.io/summary/new_code?id=Ouest-France_querydsl-postgrest

0 comments on commit 8fffa1a

Please sign in to comment.