天天看點

Spring Boot 使用 Groovy 模闆引擎開發視圖層

Spring Boot 使用 Groovy 模闆引擎開發視圖層

image.png

groovy模闆頁面擴充名是 .tpl

TplApplication.kt

package com.easy.springboot.tpl

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class TplApplication

fun main(args: Array<String>) {
    runApplication<TplApplication>(*args)
}

           
jack@jacks-MacBook-Air:~/KotlinSpringBoot/tpl$ tree
.
├── build
│   ├── kotlin
│   │   ├── compileKotlin
│   │   └── compileTestKotlin
│   └── kotlin-build
│       └── version.txt
├── build.gradle
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── src
│   ├── main
│   │   ├── kotlin
│   │   │   └── com
│   │   │       └── easy
│   │   │           └── springboot
│   │   │               └── tpl
│   │   │                   └── TplApplication.kt
│   │   └── resources
│   │       ├── application.properties
│   │       ├── static
│   │       └── templates
│   └── test
│       └── kotlin
│           └── com
│               └── easy
│                   └── springboot
│                       └── tpl
│                           └── TplApplicationTests.kt
├── tpl.iml
├── tpl.ipr
├── tpl.iws
├── tpl_main.iml
└── tpl_test.iml

23 directories, 14 files

           

詳細 參考資料:

https://spring.io/blog/2014/05/28/using-the-innovative-groovy-template-engine-in-spring-boot