问题描述
有几个Java EE API就是这样--API(接口,域对象,枚举等,但没有实际的类做东西)。像JPA,JDBC或JTA这样的API。然后,这些API必须具有实现;对于JPA,有像Hibernate,MyBatis或TopLink这样的人。对于JDBC,每个特定的RDBMS都有驱动程序。对于JTA,有Bitronix和Atomikos。
There are several Java EE APIs that exist as just that - APIs (interfaces, domain objects, enums, etc. but no actual classes that do stuff). APIs like JPA, JDBC or JTA. These APIs must then have implementations; for JPA there are impls like Hibernate, MyBatis or TopLink. For JDBC there are drivers for each specific RDBMS. For JTA there is Bitronix and Atomikos.
但JavaMail呢?它只是一个API吗?如果是这样,它的常见实现是什么?如果我将我的Java应用程序(作为WAR)部署到Tomcat 7,那么这个实现来自哪里(具体而言)? Tomcat是否有自己的JavaMail impl?什么JAR /包/类构成Tomcat impl?
But what about JavaMail? Is it just an API? If so, what are some common implementations of it? If I deploy my Java app (as a WAR) to Tomcat 7, where does this implementation come from (specifically)? Does Tomcat have its own JavaMail impl? What JARs/packages/classes compose the Tomcat impl?
推荐答案
JavaMail是标准的
JavaMail is a standard JSR 919
TomEE服务器支持JavaMail。
TomEE server has support for JavaMail.
配置非常简单,就像这样
The configuration is very easy and goes like this
- tomee已经附带
apache-tomee-plus-1.6.0 / lib / geronimo-javamail_1.4_mail-1.8.2.jar
- in
tomee.xml
(在$ TOMEE / conf
配置)您添加一个条目,如 - 从您的课程中,您可以通过<$ c $引用邮件会话c> @Resource 如
- tomee already comes with
apache-tomee-plus-1.6.0/lib/geronimo-javamail_1.4_mail-1.8.2.jar
- in
tomee.xml
(configured at$TOMEE/conf
) you add an entry as described by Configuring JavaMail - from inside your classes you can reference the mail session via
@Resource
like described at javax.mail.Session resource and smtp authentication
这篇关于JavaMail API和Tomcat 7实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!