You are getting this message because getBean returns an Object reference and you are casting it to the correct type. Java 1.5 gives you a warning. That's the nature of using Java 1.5 or better with code that works like this. Spring has the typesafe version
someMap=getApplicationContext().getBean<HashMap<String, String>>("someMap");
on its todo list.