项目作者: wonwoo

项目描述 :
spring boot kotlin example
高级语言: Kotlin
项目地址: git://github.com/wonwoo/spring-boot-kotlin-example.git
创建时间: 2016-10-21T09:53:39Z
项目社区:https://github.com/wonwoo/spring-boot-kotlin-example

开源协议:

下载


spring boot kotlin

Deploy

This is spring boot kotlin example.

Live Demo

https://spring-boot-kotlin-example.herokuapp.com

demo image1
demo image1

Login

ID : wonwoo

Password : 123

ID : user

Password : 456

How to run?

clone

  1. # git clone https://github.com/wonwoo/spring-boot-kotlin-example.git

run

  1. # cd web or webflux
  2. # mvn spring-boot:run

or

  1. # cd web or webflux
  2. # mvn install
  3. # java -jar target/${name}.jar

use

  1. kotlin 1.3.50
  2. Spring Boot 2.2.x
  3. JPA(hibernate) 5.4.8
  4. h2
  5. thymeleaf 3.0.11
  6. Spring Security 5.2.1

spring boot koilin sample code

Main sample

  1. @SpringBootApplication
  2. class SpringBootKotlinExampleApplication(private val accountRepository: AccountRepository,
  3. private val messageRepository: MessageRepository) : CommandLineRunner {
  4. override fun run(vararg p0: String?) {
  5. //.. some logic
  6. }
  7. }
  8. fun main(args: Array<String>) {
  9. runApplication<SpringBootKotlinExampleApplication>(*args)
  10. }

Service sample

  1. @Service
  2. @Transactional
  3. class MessageService constructor(val messageRepository: MessageRepository){
  4. @Transactional(readOnly = true)
  5. fun findAll() : List<Message> {
  6. return messageRepository.findAll()
  7. }
  8. // ... some logic
  9. }