Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Small example showing DIY dependency injection in a one-jar application. Featuring Spark Framework, Kotlin and Gradle.

Notifications You must be signed in to change notification settings

PorterAS/dependency-injection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a small application acting as an illustration to a blog post. It uses:

  • Kotlin as the language
  • Ktor to serve HTTP requests
  • JUnit 5 for testing

You can read more about the reasoning and setup here: https://medium.com/porterbuddy/rolling-your-own-dependency-injection-7045f8b64403

This repo has also been extended to encompass some other examples of code. To see all our blogposts go to https://medium.com/porterbuddy

Building and running

To build a ShadowJAR as a single binary distributable do:

./gradlew build shadowJar

Then to run the application:

java -jar ./build/libs/di-app.jar

Caveats

  • The KTor setup with tests does not support parallel running. You might want to look into JUnits extensions and extensioncontext to handle that.
  • We normally integrate Liquibase verification into the startup code of our app. Just do that as you wire the DI context together.

About

Small example showing DIY dependency injection in a one-jar application. Featuring Spark Framework, Kotlin and Gradle.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published