Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* main spring boot integration test with integration test profile
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CucumberRoot {
protected TestRestTemplate template;
public void before() {
// demo to show how to add custom header Globally for the http request in spring test template , like user header
template.getRestTemplate().setInterceptors(Collections.singletonList((request, body, execution) -> {
.add("userHeader", "user");
return execution.execute(request, body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment