Skip to content

Commit

Permalink
refactor: starter-thymeleaf를 api에서 implementation으로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed Dec 12, 2024
1 parent a59f2f7 commit 4ccddaf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion email/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tasks.getByName("jar") {
dependencies {
/** starter */
api("org.springframework.boot:spring-boot-starter-mail")
api("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")

/** aws ses */
implementation("com.amazonaws:aws-java-sdk-ses:${DependencyVersion.AWS_SES}")
Expand Down
15 changes: 13 additions & 2 deletions email/src/main/kotlin/email/EmailContext.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
package email

import org.thymeleaf.context.AbstractContext
import org.thymeleaf.context.Context

class EmailContext : AbstractContext()
class EmailContext(
private val context: Context = Context(),
) {

fun setVariable(name: String, value: Any) {
context.setVariable(name, value)
}

fun getContext(): Context {
return context
}
}
2 changes: 1 addition & 1 deletion email/src/main/kotlin/email/EmailTemplateProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class EmailTemplateProcessor(
) {

fun process(template: String, context: EmailContext): String {
return templateEngine.process(template, context)
return templateEngine.process(template, context.getContext())
}
}

0 comments on commit 4ccddaf

Please sign in to comment.