Java org.springframework.mail 的哪个工件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1367303/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 11:13:39  来源:igfitidea点击:

Which artifact for org.springframework.mail?

javaspringmaven-2javamail

提问by Tadeusz Kopec

I'd like to use spring support for sending mails. My project is built with maven-2 and I use spring-core 2.5.5 I tried to look in maven central repo for artifact to include in my pom.xml, and the only one I found is spring support. The problem is that the highest version in repo is 2.0.8 and it depends on spring-core v. 2.0.8. Should I add it and exclude from its dependencies spring-core, spring-aop and so on, or should I look for another artifact (but which one will do?) or use another repo? Which is the proper maven-2 artifact for org.springframework.mail and where can I find it?

我想使用 spring 支持来发送邮件。我的项目是用 maven-2 构建的,我使用 spring-core 2.5.5 我试图在 maven 中央存储库中查找要包含在我的 pom.xml 中的工件,我发现的唯一一个是spring support。问题是 repo 中的最高版本是 2.0.8,它取决于 spring-core v. 2.0.8。我应该添加它并从它的依赖项中排除 spring-core、spring-aop 等,还是应该寻找另一个工件(但哪个可以?)或使用另一个 repo?哪个是适合 org.springframework.mail 的 maven-2 工件,我在哪里可以找到它?

采纳答案by skaffman

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

邮件内容在context-support artifact 中发现,很奇怪。

回答by WillEnsaba

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

回答by Pawan Saxena

For using MailSenderand SimpleMailMessagethrough Spring you can use these imports in your code:

为了使用MailSenderSimpleMailMessage通过 Spring,您可以在代码中使用这些导入:

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 :

否则,如果您使用的是 maven,那么您必须在源代码中进行这些导入,然后添加依赖项:

  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
  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.

您将获得他们双方的邮件支持。