merge
This commit is contained in:
+11
-5
@@ -33,17 +33,23 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency> <!-- mysql driver -->
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency> <!-- druid连接池 -->
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.0.20</version>
|
||||
</dependency>
|
||||
<dependency> <!-- mysql driver -->
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- lombok:实体类自动生成getting和setting方法,以及equals,hashCode,toString等 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.xwbing.domain.entity.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -8,6 +10,7 @@ import java.util.Date;
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
@Data
|
||||
public class EmailModel {
|
||||
public EmailModel(){
|
||||
//默认值
|
||||
@@ -57,97 +60,4 @@ public class EmailModel {
|
||||
* 邮件附件的文件名
|
||||
*/
|
||||
private String[] attachFileNames;
|
||||
|
||||
public String getFromEmail() {
|
||||
return fromEmail;
|
||||
}
|
||||
|
||||
public void setFromEmail(String fromEmail) {
|
||||
this.fromEmail = fromEmail;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getToEmail() {
|
||||
return toEmail;
|
||||
}
|
||||
|
||||
public void setToEmail(String toEmail) {
|
||||
this.toEmail = toEmail;
|
||||
}
|
||||
|
||||
public Date getSendTime() {
|
||||
if (sendTime == null)
|
||||
sendTime = new Date();
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public void setSendTime(Date sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
public String getServerHost() {
|
||||
return serverHost;
|
||||
}
|
||||
|
||||
public void setServerHost(String serverHost) {
|
||||
this.serverHost = serverHost;
|
||||
}
|
||||
|
||||
public Integer getServerPort() {
|
||||
return serverPort;
|
||||
}
|
||||
|
||||
public void setServerPort(Integer serverPort) {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
public boolean isAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
public void setAuth(boolean auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getCentent() {
|
||||
return centent;
|
||||
}
|
||||
|
||||
public void setCentent(String centent) {
|
||||
this.centent = centent;
|
||||
}
|
||||
|
||||
public String[] getAttachFileNames() {
|
||||
return attachFileNames;
|
||||
}
|
||||
|
||||
public void setAttachFileNames(String[] attachFileNames) {
|
||||
this.attachFileNames = attachFileNames;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
if(protocol==null || "".equals(protocol.trim()))
|
||||
this.protocol="smtp";
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class EntityModel {
|
||||
private String character ;
|
||||
private int number;
|
||||
private Integer inte;
|
||||
private Integer integer;
|
||||
private double decimal;
|
||||
private boolean b;
|
||||
private List list;
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.*;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,11 @@ public class EmailUtil {
|
||||
if (StringUtils.isEmpty(serverHost)) {
|
||||
throw new UtilException("发送邮件主机不能为空");
|
||||
}
|
||||
props.setProperty("mail.transport.protocol", emailModel.getProtocol());// 使用的协议(JavaMail规范要求)
|
||||
String protocol = emailModel.getProtocol();
|
||||
if(protocol==null || "".equals(protocol.trim())){
|
||||
protocol="smtp";
|
||||
}
|
||||
props.setProperty("mail.transport.protocol", protocol);// 使用的协议(JavaMail规范要求)
|
||||
props.setProperty("mail.smtp.host", serverHost); // 发件人的邮箱的
|
||||
// SMTP服务器地址
|
||||
if (emailModel.getServerPort() != null) {
|
||||
@@ -77,7 +82,11 @@ public class EmailUtil {
|
||||
html.setContent(emailModel.getCentent(), "text/html; charset=utf-8");
|
||||
multipart.addBodyPart(html);
|
||||
message.setContent(multipart);
|
||||
message.setSentDate(emailModel.getSendTime());// 设置显示的发件时间
|
||||
Date sendTime = emailModel.getSendTime();
|
||||
if(sendTime==null){
|
||||
sendTime=new Date();
|
||||
}
|
||||
message.setSentDate(sendTime);// 设置显示的发件时间
|
||||
message.saveChanges();// 保存邮件
|
||||
// 4.根据 Session 获取邮件传输对象
|
||||
Transport transport = session.getTransport("smtp");
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 说明: 统一的servlet/filter配置
|
||||
* 说明: 统一servlet/filter配置
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
@@ -29,8 +29,8 @@ public class ServletFilterConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean druidServlet() {
|
||||
logger.info("注册druidServlet ======================= ");
|
||||
public ServletRegistrationBean statViewServlet() {
|
||||
logger.info("注册druid监控信息显示statViewServlet ======================= ");
|
||||
ServletRegistrationBean registration = new ServletRegistrationBean(new StatViewServlet());
|
||||
registration.addUrlMappings("/druid/*");
|
||||
//添加初始化参数:initParams
|
||||
@@ -46,9 +46,10 @@ public class ServletFilterConfig {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean webStatFilter() {
|
||||
logger.info("注册druid监控信息采集webStatFilter ======================= ");
|
||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
|
||||
filterRegistrationBean.addUrlPatterns("/*");
|
||||
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
|
||||
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,*.jsp,/druid/*");
|
||||
return filterRegistrationBean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ server:
|
||||
#spring
|
||||
spring:
|
||||
#datasource
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/springboot2?useUnicode=true&characterEncoding=utf8
|
||||
username: root
|
||||
password:
|
||||
# datasource:
|
||||
# driver-class-name: com.mysql.jdbc.Driver
|
||||
# url: jdbc:mysql://127.0.0.1:3306/springboot2?useUnicode=true&characterEncoding=utf8
|
||||
# username: root
|
||||
# password: xwbing
|
||||
#jpa
|
||||
jpa:
|
||||
database: mysql
|
||||
|
||||
Reference in New Issue
Block a user