@@ -75,54 +75,6 @@ mockMvc.get("/person/{name}", "Lee") {
75
75
76
76
77
77
78
- [[kotlin-script-templates]]
79
- == Kotlin Script Templates
80
-
81
- Spring Framework provides a
82
- {spring-framework-api}/web/servlet/view/script/ScriptTemplateView.html[`ScriptTemplateView`]
83
- which supports {JSR}223[JSR-223] to render templates by using script engines.
84
-
85
- By leveraging `scripting-jsr223` dependencies, it
86
- is possible to use such feature to render Kotlin-based templates with
87
- {kotlin-github-org}/kotlinx.html[kotlinx.html] DSL or Kotlin multiline interpolated `String`.
88
-
89
- `build.gradle.kts`
90
- [source,kotlin,indent=0]
91
- ----
92
- dependencies {
93
- runtime("org.jetbrains.kotlin:kotlin-scripting-jsr223:${kotlinVersion}")
94
- }
95
- ----
96
-
97
- Configuration is usually done with `ScriptTemplateConfigurer` and `ScriptTemplateViewResolver` beans.
98
-
99
- `KotlinScriptConfiguration.kt`
100
- [source,kotlin,indent=0]
101
- ----
102
- @Configuration
103
- class KotlinScriptConfiguration {
104
-
105
- @Bean
106
- fun kotlinScriptConfigurer() = ScriptTemplateConfigurer().apply {
107
- engineName = "kotlin"
108
- setScripts("scripts/render.kts")
109
- renderFunction = "render"
110
- isSharedEngine = false
111
- }
112
-
113
- @Bean
114
- fun kotlinScriptViewResolver() = ScriptTemplateViewResolver().apply {
115
- setPrefix("templates/")
116
- setSuffix(".kts")
117
- }
118
- }
119
- ----
120
-
121
- See the https://github.com/sdeleuze/kotlin-script-templating[kotlin-script-templating] example
122
- project for more details.
123
-
124
-
125
-
126
78
[[kotlin-multiplatform-serialization]]
127
79
== Kotlin multiplatform serialization
128
80
0 commit comments