This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
plugins { | |
id("org.springframework.boot") version "2.4.1" | |
id("io.spring.dependency-management") version "1.0.10.RELEASE" | |
kotlin("jvm") version "1.4.21" | |
kotlin("plugin.spring") version "1.4.21" | |
kotlin("plugin.serialization") version "1.4.21" // <-- (1) | |
idea | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.stefanozanella.sampleapp | |
import java.time.LocalDate | |
data class StockPurchase( | |
val ticker: String = "", | |
val purchaseDate: LocalDate = LocalDate.now(), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.stefanozanella.sampleapp | |
import com.sksamuel.avro4k.serializer.LocalDateSerializer | |
import kotlinx.serialization.Serializable | |
import java.time.LocalDate | |
@Serializable | |
data class StockPurchase( | |
val ticker: String = "", | |
@Serializable(with = LocalDateSerializer::class) val purchaseDate: LocalDate = LocalDate.now(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.stefanozanella.sampleapp | |
import org.springframework.stereotype.Controller | |
import org.springframework.ui.Model | |
import org.springframework.web.bind.annotation.GetMapping | |
import org.springframework.web.bind.annotation.ModelAttribute | |
import org.springframework.web.bind.annotation.PostMapping | |
@Controller | |
class StockPurchaseController { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Stock purchase created</title> | |
</head> | |
<body> | |
<p>Stock purchase created.</p> | |
<p th:text="${stockPurchase.ticker}" /> | |
<p th:text="${stockPurchase.purchaseDate}" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Add stock purchase</title> | |
</head> | |
<body> | |
<h2>Add a stock purchase</h2> | |
<form method="post" th:action="@{/stock_purchase}" th:object="${stockPurchase}"> | |
<p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.stefanozanella.sampleapp | |
import com.sksamuel.avro4k.Avro | |
import org.apache.avro.generic.GenericRecord | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.kafka.core.KafkaTemplate | |
import org.springframework.stereotype.Controller | |
import org.springframework.ui.Model | |
import org.springframework.web.bind.annotation.GetMapping | |
import org.springframework.web.bind.annotation.ModelAttribute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
plugins { | |
id("org.springframework.boot") version "2.7.2" | |
id("io.spring.dependency-management") version "1.0.12.RELEASE" | |
kotlin("jvm") version "1.6.21" | |
kotlin("plugin.spring") version "1.6.21" | |
} | |
group = "me.stefanozanella" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// ... | |
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
class HomeController { | |
@GetMapping("/") | |
fun home() = "home" | |
} |