Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting the context object after setting it using @ContextConfiguration

Tags:

junit

spring

How do I get ApplicationContext object so that i can use it in my code, after setting context using@ContextConfiguration.

My test class extends AbstractTransactionalJUnit4SpringContextTests.

like image 320
user620339 Avatar asked Dec 06 '22 22:12

user620339


1 Answers

I generaly just inject a copy of the Application Context into the unit test:

 @Autowired 
   ApplicationContext context;
like image 89
Karthik Ramachandran Avatar answered May 02 '23 00:05

Karthik Ramachandran