Which artifact for org.springframework.mail?

空扰寡人 提交于 2020-12-27 08:10:49

问题


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?


回答1:


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




回答2:


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



回答3:


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.



来源:https://stackoverflow.com/questions/1367303/which-artifact-for-org-springframework-mail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!