Testing Spring Boot applications with Archillian Cube


I was wondering if anybody could help me figure out how to test a Spring Boot application using Arquillian Cube. The main problem is that the application is not able to find the application.properties file needed to start up. It starts up atThey are located within the application at this location


The application tries to start but it fails when it is not able to find properties located in the archillian-cube.properties file.

Thank you in advance for all your help

Maria Gabriela Mino

My archillian.xml looks like this:

<extension qualifier="docker">
                <property name="serverVersion">1.26</property>
                <property name="definitionFormat">COMPOSE</property>
                <property name="machineName">default</property>
                <property name="dockerContainersFile">docker-compose.yml</property>

And my docker-compose.yml file looks like

  image: <image>
  alwaysPull: true
    strategy: polling
  env: [SPRING.CONFIG.LOCATION=src/test/resources/arquillianTest/arquillian-cube.properties, JAVA_OPTS= -Dcom.sun.management.jmxremote.port=8443 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false]
  portBindings: [5001/tcp, 8443/tcp]

My test looks like this:

public class RestAssuredTest {
                private String ip;
                @HostPort(containerName = "cgwCompose", value = 5001)
                int cgwPort;
    public void getTransactionsTest() throws IOException {
                URL url = new URL("http://" + ip + ":" + cgwPort + "/rest/v2/transactions/");
                String responseBody = given().relaxedHTTPSValidation()
                                                .headers("accept", "application/json", "api-key", "", "Content-type", "application/json")
        assertNotNull("Error: null response", responseBody);


Hi Maria, the problem you are facing here is that the environment variable points to a local directory src/test/resources but this location should be a location where the application is running, in this case inside docker container, so this variable should point to an existing location inside docker container since it is where the spring boot application is running, and not local directory.

Last note is that this is a cube format and not docker-compose format so you should change this COMPOSE to CUBE or adapt the file to a docker-compose format.



I was able to get it to pick up the spring.config.location by doing the following:

  1. I am using Docker Toolbox which contains a default Boot2Docker machine. I followed the mounting volumes steps in this post https://www.viget.com/articles/how-to-use-docker-on-os-x-the-missing-guide in order to access the c:/Users/ directory from my local computer.

  2. I followed the containerObject pattern in order to specify the host and container volumes with the following annotations:

    @Cube(value = “test”, portBinding = “5000->8433/tcp”)
    @Volume(hostPath = “/c/Users/gmino”, containerPath = “/opt/properties”)
    @Environment(key = “SPRING.CONFIG.LOCATION”, value = “file:/opt/properties/arquillian-cube.properties”)
    public class TestContainerObject {
    In my test I have

     public class PingPongTest {
         TestContainerObject testContainer;
        public void shouldReturnOkAsPong() throws IOException {

But I still not sure what would be the syntax inside the docker-compose.yml file for volumes


Maybe these Spring Boot tutorials can help you.