This sample uses pure Java POJOs as configuration.


Citrus uses Spring Framework as glue for everything. Following from that Citrus components are defined as Spring beans in an application context. You can use XML configuration files and you can also use Java POJOs.

This sample uses pure Java code for both Citrus configuration and tests. The Citrus TestNG test uses a context configuration annotation.

@ContextConfiguration(classes = { EndpointConfig.class })

This tells Spring to load the configuration from the Java class EndpointConfig.

public HttpClient todoClient() {
    return CitrusEndpoints.http()

In the configuration class we are able to define Citrus components for usage in tests. As usual we can autowire the Http client component as Spring bean in the test cases.

private HttpClient todoClient;

As usual we are able to reference this endpoint in any send and receive operation in Citrus Java fluent API.


Citrus and Spring framework automatically injects the endpoint with respective configuration for requestUrl = http://localhost:8080.


You can run the sample on your localhost in order to see Citrus in action. Read the instructions how to run the sample.