Org.springframework.mail 的哪个工件?

我想用春季支持来发送邮件。我的项目是用 maven-2构建的,我使用 spring-core 2.5.5,我尝试在 maven 的中央回购中寻找工件,以便包含在 pom.xml 中,我找到的唯一一个工件是 弹簧支撑。问题是,回购的最高版本是2.0.8,它取决于 spring-core v. 2.0.8。我应该添加它并从它的依赖项 spring-core、 spring-aop 等中排除它,还是应该寻找另一个工件(但是哪个工件可以呢?)还是用另一种回购方式?哪一个是 org.springframework.mail 适合的 maven-2工件,我在哪里可以找到它?

68874 次浏览

The mail stuff is found, rather bizarrely, in the context-support artifact.

 <!-- ########### SPRING-CONTEXT-SUPPORT ############ -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>

For using MailSender and SimpleMailMessage through Spring you can use these imports in your code:

import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

And add their jars in your project.

Otherwise if you are using maven then you have to make these imports in your source and then add dependencies :

  1. http://mvnrepository.com/artifact/org.springframework/spring-support/2.0.6
  2. http://mvnrepository.com/artifact/org.springframework/spring-context-support/3.2.0.RELEASE

You will get the mail support from both of them.