提交 c9a721ff 编写于 作者: 2 2293736867

Update Spring Boot 2.4.3 and Gradle 6.8.2 Mail

上级 a008920a
......@@ -13,6 +13,9 @@ build/
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
......
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "2.3.4.RELEASE"
id("io.spring.dependency-management") version "1.0.10.RELEASE"
kotlin("jvm") version "1.3.72"
kotlin("plugin.spring") version "1.3.72"
id("org.springframework.boot") version "2.4.3"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.4.30"
kotlin("plugin.spring") version "1.4.30"
}
group = "com.example"
......@@ -30,13 +30,7 @@ dependencies {
implementation("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3")
developmentOnly("org.springframework.boot:spring-boot-devtools")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
}
tasks.withType<Test> {
useJUnitPlatform()
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
tasks.withType<KotlinCompile> {
......@@ -45,3 +39,7 @@ tasks.withType<KotlinCompile> {
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
文件模式从 100755 更改为 100644
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
......@@ -11,17 +11,16 @@ import java.nio.file.Path
import javax.mail.internet.MimeMessage
@Service
class MailServiceImpl:MailService {
class MailServiceImpl : MailService {
@Autowired
lateinit var sender:JavaMailSender
lateinit var sender: JavaMailSender
companion object{
companion object {
var from = ""
}
@Value("\${spring.mail.username}")
fun setFrom(username:String)
{
fun setFrom(username: String) {
from = username
}
......@@ -35,14 +34,14 @@ class MailServiceImpl:MailService {
sender.send(message)
}
override fun sendAttachmentMail(to: String, subject: String,content: String, file: Path) {
val message:MimeMessage = sender.createMimeMessage()
val helper = MimeMessageHelper(message,true)
override fun sendAttachmentMail(to: String, subject: String, content: String, file: Path) {
val message: MimeMessage = sender.createMimeMessage()
val helper = MimeMessageHelper(message, true)
helper.setFrom(from)
helper.setTo(to)
helper.setSubject(subject)
helper.setText(content)
helper.addAttachment(file.fileName.toString(),FileSystemResource(file))
helper.addAttachment(file.fileName.toString(), FileSystemResource(file))
sender.send(message)
}
}
\ No newline at end of file
......@@ -17,4 +17,4 @@ spring:
jasypt:
encryptor:
password: test
\ No newline at end of file
password: test
......@@ -9,29 +9,27 @@ import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
class EncryptAndDecrypt {
@Autowired
lateinit var encryptor:StringEncryptor
lateinit var encryptor: StringEncryptor
companion object{
companion object {
var username = ""
var password = ""
}
@Value("\${spring.mail.username}")
fun setUsername(value:String)
{
fun setUsername(value: String) {
username = value
}
@Value("\${spring.mail.password}")
fun setPassword(value: String)
{
fun setPassword(value: String) {
password = value
}
@Test
fun getEncrypted() = println(encryptor.encrypt(username)+"\n"+encryptor.encrypt(password))
fun getEncrypted() = println(encryptor.encrypt(username) + "\n" + encryptor.encrypt(password))
@Test
fun getDecrypted() = println(username+"\n"+password)
fun getDecrypted() = println(username + "\n" + password)
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册