We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
You can use Spring @Configuration and @Bean data annotation to register the Kontent Delivery client and then used @Autowired when you need to use it
@Configuration
@Bean
@Autowired
The approach is showcased on Spring Boot sample application - the code part is in ~/sample-app-spring-boot/src/main/java/kentico/kontent/delivery/sample/dancinggoat/springboot/KontentConfiguration.java file.
You can see there you can register recovers as well. The template is simple.
// ... @Configuration public class KontentConfiguration { @Bean public DeliveryClient deliveryClient() { DeliveryClient client = new DeliveryClient( DeliveryOptions .builder() .projectId("975bf280-fd91-488c-994c-2f04416e5ee3") .customHeaders(Arrays.asList( new Header(TRACKING_HEADER_NAME, TRACKING_HEADER_VALUE) )) .build() ); // ... additional configuration of the client } }
And then in a (most probably) controller, you just use the client:
// ... @Controller public class ArticleController { @Autowired DeliveryClient deliveryClient; // ... }