Created
January 5, 2018 13:47
-
-
Save arnaudgiuliani/b2e26e75144ec6e997e6d5dc6ebc37ba to your computer and use it in GitHub Desktop.
HelloController for Spark, Service & Repository
This file contains hidden or 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
| class HelloController(val service: HelloService) { | |
| init { | |
| get("/hello") { | |
| service.sayHello() | |
| } | |
| } | |
| } |
This file contains hidden or 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
| interface HelloRepository { | |
| fun getHello(): String | |
| } | |
| class HelloRepositoryImpl : HelloRepository { | |
| override fun getHello(): String = "Spark & Koin" | |
| } |
This file contains hidden or 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
| interface HelloService { | |
| fun sayHello(): String | |
| } | |
| class HelloServiceImpl(val helloRepository: HelloRepository) : HelloService { | |
| override fun sayHello() = "Hello ${helloRepository.getHello()} !" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment