Use ApplicationContext#getBean with Generics (Best Practice) Spring supports generic type inference with this method: private Map<String, String> someMap = getApplicationContext().getBean(“someMap”, Map.class);
Why?
Eliminates unchecked cast warnings without suppression.