我正在从下面的链接运行示例:
http://chathurangat.blogspot.se/2011/12/send-email-in-spring-with-gmail.html
它工作正常。我的问题是为什么
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("emailConfiguration.xml");
EmailSender emailSender=(EmailSender)context.getBean("emailSenderBean");
被放置在控制器中?有没有更好的读取xml文件的方法?并创建 bean?
ClassPathXmlApplicationContext 可以自动装配吗?
如何将此示例与 JPA 一起使用?
谢谢