I can't understand why this code registers my bean :

new ClassPathXmlApplicationContext("beans.xml");
but this one doesn't :

ClassPathResource res = new ClassPathResource("beans.xml");...