使用spring實(shí)現(xiàn)郵件的發(fā)送實(shí)例(含測(cè)試,源碼,注釋?zhuān)?/h1>
更新時(shí)間:2017年05月31日 11:25:44 作者:一步一步完善
本篇文章主要介紹了使用spring實(shí)現(xiàn)郵件的發(fā)送實(shí)例,詳細(xì)的介紹了使用spring配置實(shí)現(xiàn)郵件發(fā)送,含測(cè)試,源碼,注釋?zhuān)信d趣的可以下
此篇主要講的是使用spring配置實(shí)現(xiàn)郵件發(fā)送,與之前的底層實(shí)現(xiàn)簡(jiǎn)便了不少,只需要幾個(gè)配置就可以了,那么請(qǐng)往下看:
先寫(xiě)個(gè)接口
/**
* @Title: IMailserdService.java
* @Package org.service
* @Description: TODO該方法的主要作用:
* @author A18ccms A18ccms_gmail_com
* @date 2017-5-30 上午10:36:34
* @version V1.0
*/
package org.service;
/**
*
* 項(xiàng)目名稱(chēng):spring_Schop8
* 類(lèi)名稱(chēng):IMailserdService
* 類(lèi)描述:
* 創(chuàng)建人:Mu Xiongxiong
* 修改備注:
* @version
*
*/
public interface IMailsendService {
/**
*
* @Title: sendMessage
* @Description: 該方法的主要作用:發(fā)送郵件
* @param 設(shè)定文件
* @return 返回類(lèi)型:void
* @throws
*/
void sendMessage();
}
然后在寫(xiě)個(gè)實(shí)現(xiàn)該接口的類(lèi):
/**
* @Title: AttMailsendServiceImpl.java
* @Package org.service.impl
* @Description: TODO該方法的主要作用:
* @author A18ccms A18ccms_gmail_com
* @date 2017-5-30 上午11:12:02
* @version V1.0
*/
package org.service.impl;
import java.io.IOException;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.service.IMailsendService;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
/**
*
* 項(xiàng)目名稱(chēng):spring_Schop8
* 類(lèi)名稱(chēng):AttMailsendServiceImpl
* 類(lèi)描述: 使用spring實(shí)現(xiàn)對(duì)郵件的發(fā)送
* 創(chuàng)建人:Mu Xiongxiong
* 修改備注:
* @version
*
*/
public class AttMailsendServiceImpl implements IMailsendService {
private JavaMailSender javaMailSender;
/**(非 Javadoc)
* <p>Title: sendMessage</p>
* <p>Description(描述):發(fā)送帶附件的郵件 </p>
* @see org.service.IMailsendService#sendMessage()
*/
@Override
public void sendMessage() {
MimeMessage message = javaMailSender.createMimeMessage();
MimeMessageHelper helper;
try {
helper = new MimeMessageHelper(message,true,"utf-8");
helper.setFrom("jerry@mail.com");
helper.setTo("tina@mail.com");
helper.setSubject("帶附件的郵件");
//普通格式的
//helper.setText("發(fā)送一個(gè)附件內(nèi)容!<a );
//html格式的
helper.setText("發(fā)送一個(gè)附件內(nèi)容!<a ,true);
//添加附件1
ClassPathResource file1 = new ClassPathResource("/org/doc/doc.txt");
helper.addAttachment(file1.getFilename(),file1.getFile());
//添加附件2
ClassPathResource file2 = new ClassPathResource("/org/doc/text.txt");
helper.addAttachment(file2.getFilename(), file2.getFile());
javaMailSender.send(message);
} catch (MessagingException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
} catch (IOException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
}
}
public JavaMailSender getJavaMailSender() {
return javaMailSender;
}
public void setJavaMailSender(JavaMailSender javaMailSender) {
this.javaMailSender = javaMailSender;
}
}
上面的這個(gè)類(lèi)還可以發(fā)送帶附件的郵件,里面含兩個(gè)附件(文件),我弄上來(lái)吧:

還有一種是使用模板發(fā)送帶html格式的郵件:
我直接上實(shí)現(xiàn)類(lèi):
/**
* @Title: CreateMatterServiceImpl.java
* @Package org.service.impl
* @Description: TODO該方法的主要作用:
* @author A18ccms A18ccms_gmail_com
* @date 2017-5-30 上午11:46:53
* @version V1.0
*/
package org.service.impl;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.service.IMailsendService;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
/**
*
* 項(xiàng)目名稱(chēng):spring_Schop8
* 類(lèi)名稱(chēng):CreateMatterServiceImpl
* 類(lèi)描述:
* 創(chuàng)建人:Mu Xiongxiong
* 修改備注:
* @version
*
*/
public class CreateMatterServiceImpl implements IMailsendService {
private JavaMailSender javaMailSender;
private Configuration configuration;
/**(非 Javadoc)
* <p>Title: sendMessage</p>
* <p>Description(描述):使用后模板發(fā)送郵件 </p>
* @see org.service.IMailsendService#sendMessage()
*/
@Override
public void sendMessage() {
MimeMessage message = javaMailSender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message,true,"UTF-8");
helper.setFrom("jerry@mail.com");
helper.setTo("tina@mail.com");
helper.setSubject("使用模板進(jìn)行發(fā)送郵件");
helper.setText(getText(),true);
//從模板里面讀取
javaMailSender.send(message);
} catch (MessagingException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
}
}
//讀取模板
private String getText(){
String txt = "";
try {
Template template = configuration.getTemplate("mail.ftl");
//通過(guò)map傳遞動(dòng)態(tài)數(shù)據(jù)
Map map = new HashMap();
map.put("username","雄雄");
//解析模板文件
txt = FreeMarkerTemplateUtils.processTemplateIntoString(template,map);
} catch (IOException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
} catch (TemplateException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
}
return txt;
}
public JavaMailSender getJavaMailSender() {
return javaMailSender;
}
public void setJavaMailSender(JavaMailSender javaMailSender) {
this.javaMailSender = javaMailSender;
}
public Configuration getConfiguration() {
return configuration;
}
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
}
模板文件如下:

然后在看看spring里面是怎么配置的呢?
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="mailsender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="mail.com"></property>
<property name="port" value="25"></property>
<property name="username" value="jerry"></property>
<property name="password" value="123" ></property>
<property name="protocol" value="smtp"></property>
<property name="defaultEncoding" value="utf-8"></property>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
</props>
</property>
</bean>
<!-- 配置FreeMarker-->
<bean id="freeMarkerConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
<!-- 指定模板文件路徑 -->
<property name="templateLoaderPath" value="org/doc/"></property>
<!-- 設(shè)置freekMarker環(huán)境變量 -->
<property name="freemarkerSettings">
<props>
<prop key="default_encoding">UTF-8</prop>
</props>
</property>
</bean>
<!-- 簡(jiǎn)單郵件 -->
<bean id="simpleMailsendService" class="org.service.impl.SimpleMailsendServiceImpl">
<property name="sender" ref="mailsender"></property>
</bean>
<!-- html和帶附件的郵件 -->
<bean id="AttMailsendService" class="org.service.impl.AttMailsendServiceImpl">
<property name="javaMailSender" ref="mailsender"></property>
</bean>
<!-- 使用模板發(fā)送郵件-->
<bean id="createMatterService" class="org.service.impl.CreateMatterServiceImpl">
<property name="configuration" ref="freeMarkerConfiguration"></property>
<property name="javaMailSender" ref="mailsender"></property>
</bean>
</beans>
當(dāng)前時(shí)間已經(jīng)是00點(diǎn)多了,又累又困,我就不詳細(xì)解釋這個(gè)applicationContexct.xml里面的內(nèi)容了,里面有注釋?zhuān)床欢目梢栽u(píng)論,我第一時(shí)間改進(jìn)!
接著我們測(cè)試一下:
TestMail:
package org.test;
import org.junit.Test;
import org.service.IMailsendService;
import org.service.impl.Mail;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestMail {
@Test
public void testMail() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//簡(jiǎn)單郵件
//IMailsendService mailsendService=(IMailsendService) ctx.getBean("simpleMailsendService");
//復(fù)雜郵件
//IMailsendService mailsendService=(IMailsendService) ctx.getBean("AttMailsendService");
//使用模板的文件
IMailsendService mailsendService=(IMailsendService) ctx.getBean("createMatterService");
mailsendService.sendMessage();
System.out.println("發(fā)送成功!");
}
}
注明一下:簡(jiǎn)單郵件是直接發(fā)的文本內(nèi)容,復(fù)雜郵件是包含html格式和附件的,模板發(fā)送是html格式的另一種方式,我們來(lái)看看運(yùn)行的結(jié)果:
先看看帶附件,還有html格式的郵件:

接下來(lái)是簡(jiǎn)單郵件:

接下來(lái)的一種是使用模板發(fā)送郵件,用戶名是動(dòng)態(tài)上去的:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:- Spring學(xué)習(xí)筆記3之消息隊(duì)列(rabbitmq)發(fā)送郵件功能
- Java的Spring框架中實(shí)現(xiàn)發(fā)送郵件功能的核心代碼示例
- springMVC發(fā)送郵件的簡(jiǎn)單實(shí)現(xiàn)
- Spring Boot實(shí)戰(zhàn)之發(fā)送郵件示例代碼
- Spring Boot中利用JavaMailSender發(fā)送郵件的方法示例(附源碼)
- spring mail借助qq郵箱服務(wù)器發(fā)送郵件
- Spring+quartz實(shí)現(xiàn)定時(shí)發(fā)送郵件功能實(shí)例
- Spring Boot實(shí)現(xiàn)郵件發(fā)送功能
- Spring實(shí)現(xiàn)郵件發(fā)送功能
- spring+maven實(shí)現(xiàn)郵件發(fā)送
相關(guān)文章
-
Mybatis返回單個(gè)實(shí)體或者返回List的實(shí)現(xiàn)
這篇文章主要介紹了Mybatis返回單個(gè)實(shí)體或者返回List的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧 2020-07-07
-
在Java Web項(xiàng)目中添加定時(shí)任務(wù)的方法
在Java Web程序中加入定時(shí)任務(wù),這里介紹兩種方式使用監(jiān)聽(tīng)器注入,使用Spring注解@Scheduled注入,需要的朋友可以參考下 2018-01-01
-
Spring中@Transactional注解的屬性說(shuō)明
這篇文章主要介紹了Spring中@Transactional注解的屬性說(shuō)明,@Transactional 是聲明式事務(wù)管理 編程中使用的注解,@Transactional 注解應(yīng)該只被應(yīng)用到 public 方法上,這是由 Spring AOP 的本質(zhì)決定的,需要的朋友可以參考下 2023-11-11
-
Springboot項(xiàng)目打war包docker包找不到resource下靜態(tài)資源的解決方案
今天小編就為大家分享一篇關(guān)于Springboot項(xiàng)目打war包docker包找不到resource下靜態(tài)資源的解決方案,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧 2019-03-03
-
Spring學(xué)習(xí)JdbcTemplate數(shù)據(jù)庫(kù)事務(wù)參數(shù)
這篇文章主要為大家介紹了Spring學(xué)習(xí)JdbcTemplate數(shù)據(jù)庫(kù)事務(wù)參數(shù)使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪 2022-05-05
最新評(píng)論
此篇主要講的是使用spring配置實(shí)現(xiàn)郵件發(fā)送,與之前的底層實(shí)現(xiàn)簡(jiǎn)便了不少,只需要幾個(gè)配置就可以了,那么請(qǐng)往下看:
先寫(xiě)個(gè)接口
/**
* @Title: IMailserdService.java
* @Package org.service
* @Description: TODO該方法的主要作用:
* @author A18ccms A18ccms_gmail_com
* @date 2017-5-30 上午10:36:34
* @version V1.0
*/
package org.service;
/**
*
* 項(xiàng)目名稱(chēng):spring_Schop8
* 類(lèi)名稱(chēng):IMailserdService
* 類(lèi)描述:
* 創(chuàng)建人:Mu Xiongxiong
* 修改備注:
* @version
*
*/
public interface IMailsendService {
/**
*
* @Title: sendMessage
* @Description: 該方法的主要作用:發(fā)送郵件
* @param 設(shè)定文件
* @return 返回類(lèi)型:void
* @throws
*/
void sendMessage();
}
然后在寫(xiě)個(gè)實(shí)現(xiàn)該接口的類(lèi):
/**
* @Title: AttMailsendServiceImpl.java
* @Package org.service.impl
* @Description: TODO該方法的主要作用:
* @author A18ccms A18ccms_gmail_com
* @date 2017-5-30 上午11:12:02
* @version V1.0
*/
package org.service.impl;
import java.io.IOException;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.service.IMailsendService;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
/**
*
* 項(xiàng)目名稱(chēng):spring_Schop8
* 類(lèi)名稱(chēng):AttMailsendServiceImpl
* 類(lèi)描述: 使用spring實(shí)現(xiàn)對(duì)郵件的發(fā)送
* 創(chuàng)建人:Mu Xiongxiong
* 修改備注:
* @version
*
*/
public class AttMailsendServiceImpl implements IMailsendService {
private JavaMailSender javaMailSender;
/**(非 Javadoc)
* <p>Title: sendMessage</p>
* <p>Description(描述):發(fā)送帶附件的郵件 </p>
* @see org.service.IMailsendService#sendMessage()
*/
@Override
public void sendMessage() {
MimeMessage message = javaMailSender.createMimeMessage();
MimeMessageHelper helper;
try {
helper = new MimeMessageHelper(message,true,"utf-8");
helper.setFrom("jerry@mail.com");
helper.setTo("tina@mail.com");
helper.setSubject("帶附件的郵件");
//普通格式的
//helper.setText("發(fā)送一個(gè)附件內(nèi)容!<a );
//html格式的
helper.setText("發(fā)送一個(gè)附件內(nèi)容!<a ,true);
//添加附件1
ClassPathResource file1 = new ClassPathResource("/org/doc/doc.txt");
helper.addAttachment(file1.getFilename(),file1.getFile());
//添加附件2
ClassPathResource file2 = new ClassPathResource("/org/doc/text.txt");
helper.addAttachment(file2.getFilename(), file2.getFile());
javaMailSender.send(message);
} catch (MessagingException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
} catch (IOException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
}
}
public JavaMailSender getJavaMailSender() {
return javaMailSender;
}
public void setJavaMailSender(JavaMailSender javaMailSender) {
this.javaMailSender = javaMailSender;
}
}
上面的這個(gè)類(lèi)還可以發(fā)送帶附件的郵件,里面含兩個(gè)附件(文件),我弄上來(lái)吧:

還有一種是使用模板發(fā)送帶html格式的郵件:
我直接上實(shí)現(xiàn)類(lèi):
/**
* @Title: CreateMatterServiceImpl.java
* @Package org.service.impl
* @Description: TODO該方法的主要作用:
* @author A18ccms A18ccms_gmail_com
* @date 2017-5-30 上午11:46:53
* @version V1.0
*/
package org.service.impl;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.service.IMailsendService;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
/**
*
* 項(xiàng)目名稱(chēng):spring_Schop8
* 類(lèi)名稱(chēng):CreateMatterServiceImpl
* 類(lèi)描述:
* 創(chuàng)建人:Mu Xiongxiong
* 修改備注:
* @version
*
*/
public class CreateMatterServiceImpl implements IMailsendService {
private JavaMailSender javaMailSender;
private Configuration configuration;
/**(非 Javadoc)
* <p>Title: sendMessage</p>
* <p>Description(描述):使用后模板發(fā)送郵件 </p>
* @see org.service.IMailsendService#sendMessage()
*/
@Override
public void sendMessage() {
MimeMessage message = javaMailSender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message,true,"UTF-8");
helper.setFrom("jerry@mail.com");
helper.setTo("tina@mail.com");
helper.setSubject("使用模板進(jìn)行發(fā)送郵件");
helper.setText(getText(),true);
//從模板里面讀取
javaMailSender.send(message);
} catch (MessagingException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
}
}
//讀取模板
private String getText(){
String txt = "";
try {
Template template = configuration.getTemplate("mail.ftl");
//通過(guò)map傳遞動(dòng)態(tài)數(shù)據(jù)
Map map = new HashMap();
map.put("username","雄雄");
//解析模板文件
txt = FreeMarkerTemplateUtils.processTemplateIntoString(template,map);
} catch (IOException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
} catch (TemplateException e) {
// TODO 異常執(zhí)行塊!
e.printStackTrace();
}
return txt;
}
public JavaMailSender getJavaMailSender() {
return javaMailSender;
}
public void setJavaMailSender(JavaMailSender javaMailSender) {
this.javaMailSender = javaMailSender;
}
public Configuration getConfiguration() {
return configuration;
}
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
}
模板文件如下:

然后在看看spring里面是怎么配置的呢?
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="mailsender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="mail.com"></property>
<property name="port" value="25"></property>
<property name="username" value="jerry"></property>
<property name="password" value="123" ></property>
<property name="protocol" value="smtp"></property>
<property name="defaultEncoding" value="utf-8"></property>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
</props>
</property>
</bean>
<!-- 配置FreeMarker-->
<bean id="freeMarkerConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
<!-- 指定模板文件路徑 -->
<property name="templateLoaderPath" value="org/doc/"></property>
<!-- 設(shè)置freekMarker環(huán)境變量 -->
<property name="freemarkerSettings">
<props>
<prop key="default_encoding">UTF-8</prop>
</props>
</property>
</bean>
<!-- 簡(jiǎn)單郵件 -->
<bean id="simpleMailsendService" class="org.service.impl.SimpleMailsendServiceImpl">
<property name="sender" ref="mailsender"></property>
</bean>
<!-- html和帶附件的郵件 -->
<bean id="AttMailsendService" class="org.service.impl.AttMailsendServiceImpl">
<property name="javaMailSender" ref="mailsender"></property>
</bean>
<!-- 使用模板發(fā)送郵件-->
<bean id="createMatterService" class="org.service.impl.CreateMatterServiceImpl">
<property name="configuration" ref="freeMarkerConfiguration"></property>
<property name="javaMailSender" ref="mailsender"></property>
</bean>
</beans>
當(dāng)前時(shí)間已經(jīng)是00點(diǎn)多了,又累又困,我就不詳細(xì)解釋這個(gè)applicationContexct.xml里面的內(nèi)容了,里面有注釋?zhuān)床欢目梢栽u(píng)論,我第一時(shí)間改進(jìn)!
接著我們測(cè)試一下:
TestMail:
package org.test;
import org.junit.Test;
import org.service.IMailsendService;
import org.service.impl.Mail;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestMail {
@Test
public void testMail() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//簡(jiǎn)單郵件
//IMailsendService mailsendService=(IMailsendService) ctx.getBean("simpleMailsendService");
//復(fù)雜郵件
//IMailsendService mailsendService=(IMailsendService) ctx.getBean("AttMailsendService");
//使用模板的文件
IMailsendService mailsendService=(IMailsendService) ctx.getBean("createMatterService");
mailsendService.sendMessage();
System.out.println("發(fā)送成功!");
}
}
注明一下:簡(jiǎn)單郵件是直接發(fā)的文本內(nèi)容,復(fù)雜郵件是包含html格式和附件的,模板發(fā)送是html格式的另一種方式,我們來(lái)看看運(yùn)行的結(jié)果:
先看看帶附件,還有html格式的郵件:

接下來(lái)是簡(jiǎn)單郵件:

接下來(lái)的一種是使用模板發(fā)送郵件,用戶名是動(dòng)態(tài)上去的:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Spring學(xué)習(xí)筆記3之消息隊(duì)列(rabbitmq)發(fā)送郵件功能
- Java的Spring框架中實(shí)現(xiàn)發(fā)送郵件功能的核心代碼示例
- springMVC發(fā)送郵件的簡(jiǎn)單實(shí)現(xiàn)
- Spring Boot實(shí)戰(zhàn)之發(fā)送郵件示例代碼
- Spring Boot中利用JavaMailSender發(fā)送郵件的方法示例(附源碼)
- spring mail借助qq郵箱服務(wù)器發(fā)送郵件
- Spring+quartz實(shí)現(xiàn)定時(shí)發(fā)送郵件功能實(shí)例
- Spring Boot實(shí)現(xiàn)郵件發(fā)送功能
- Spring實(shí)現(xiàn)郵件發(fā)送功能
- spring+maven實(shí)現(xiàn)郵件發(fā)送
相關(guān)文章
Mybatis返回單個(gè)實(shí)體或者返回List的實(shí)現(xiàn)
這篇文章主要介紹了Mybatis返回單個(gè)實(shí)體或者返回List的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07
在Java Web項(xiàng)目中添加定時(shí)任務(wù)的方法
在Java Web程序中加入定時(shí)任務(wù),這里介紹兩種方式使用監(jiān)聽(tīng)器注入,使用Spring注解@Scheduled注入,需要的朋友可以參考下2018-01-01
Spring中@Transactional注解的屬性說(shuō)明
這篇文章主要介紹了Spring中@Transactional注解的屬性說(shuō)明,@Transactional 是聲明式事務(wù)管理 編程中使用的注解,@Transactional 注解應(yīng)該只被應(yīng)用到 public 方法上,這是由 Spring AOP 的本質(zhì)決定的,需要的朋友可以參考下2023-11-11
Springboot項(xiàng)目打war包docker包找不到resource下靜態(tài)資源的解決方案
今天小編就為大家分享一篇關(guān)于Springboot項(xiàng)目打war包docker包找不到resource下靜態(tài)資源的解決方案,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-03-03
Spring學(xué)習(xí)JdbcTemplate數(shù)據(jù)庫(kù)事務(wù)參數(shù)
這篇文章主要為大家介紹了Spring學(xué)習(xí)JdbcTemplate數(shù)據(jù)庫(kù)事務(wù)參數(shù)使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-05-05

