Give Gatling a Spring boot context

I have a spring boot application that can generate data I want to put in Gatling’s feeders. I wanted to use a simulation like this :

public class MySimulation extends Simulation {

    @Autowired
    public DataFeederBean dataFeederBean;

    public MySimulation() {
        // Simulation code goes here...
    }
}

Obviously, this doesn’t work since the simulation is not launched along with a spring boot context … I already tried to write a simple simulation runner that would be called from my spring application (it works, i can run a simple simulation from it), but the beans are still not available for the simulation. Did anyone ever tried to integrate Gatling to a Spring boot app ?

Also answered on StackOverflow where you also posted.

You can’t use @Autowired . You have to create an ApplicationContext programmatically and pull the JMSConnectionFactoryBeanClass from it.

1 Like