# Give Gatling a Spring boot context

**URL:** <https://community.gatling.io/t/give-gatling-a-spring-boot-context/7569>\
**Category:** Gatling (Open-Source)\
**Created:** [January 26, 2023, 3:06pm UTC](https://community.gatling.io/t/give-gatling-a-spring-boot-context/7569 "2023-01-26T15:06:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![e.simon](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@e.simon](https://community.gatling.io/u/e.simon)\
**Post date:** [January 26, 2023, 3:06pm UTC](https://community.gatling.io/t/give-gatling-a-spring-boot-context/7569/1 "2023-01-26T15:06:52Z")

</div>

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 :

```java
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 ?

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 27, 2023, 9:14am UTC](https://community.gatling.io/t/give-gatling-a-spring-boot-context/7569/2 "2023-01-27T09:14:17Z")

</div>

Also answered on StackOverflow where you also posted.

You can’t use `@Autowired` . You have to create an [`ApplicationContext`](https://www.baeldung.com/spring-application-context) programmatically and pull the JMSConnectionFactoryBeanClass from it.

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [January 29, 2023, 10:59am UTC](https://community.gatling.io/t/give-gatling-a-spring-boot-context/7569/3 "2023-01-29T10:59:08Z")

</div>

Closed on January 29, 2023, 10:59am UTC


