What I don’t know is what the lifetime of the TestContextManager should be. This works though.
r
robfletcher
02/22/2020, 2:21 PM
Typically spring tests create an application context once then run all the tests in the class. There is an annotation you can invoke to change this so it recreates the context for every individual test.
Not sure that’s directly relevant to what you’re asking but it seems to be
That annotation can apply to individual tests as well. I’ve never used it that way, and honestly, having to use it at all IMO indicates things are kind of a mess
d
dmcg
02/22/2020, 4:18 PM
Thanks @robfletcher - I’ll look at how many application contexts are created. It currently only starts the servlet container once, but I don’t know if that means the same thing.
r
robfletcher
02/22/2020, 5:15 PM
It should do, and that’s typically the desired behavior