In a spring MVC application, I initialize a variable in one of the service classes using the following approach:
ApplicationContext context =
new C
Casting is the correct resolution for this issue.
I faced the same issue using the below line.
ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
To resolve the warning just downcast the ctx object like below and then close it.
((AnnotationConfigApplicationContext) ctx).close();