Refactoring From Spring Boot to Kotlin

preview_player
Показать описание
In this video Dmitry Kandalov and I look at a small Spring Boot web application, trying to understand what it does and how. As we do, we discover that some of the dependencies on Spring are unnecessary, and the more we remove, the easier it is to reason about how our application actually works.

We almost succeed in replacing Dependency Injection with Just Creating Objects, but are foiled at the last because we never actually get to instantiate the top-level components ourselves. Undeterred we reimplement the app using the http4k library and show that it passes the original Spring acceptance tests.

No actual Spring Boot applications were harmed in the making of this video.

If you like this, you’ll probably like the book Java to Kotlin, A Refactoring Guidebook
.

Рекомендации по теме
Комментарии
Автор

Nice to see Dmitry again. Thanks you Duncan for all your videos and bringing Dmitry back ;)

RazvanBunea
Автор

14:09 For constructor injection, no @Autowired annotation is required. That might be why the IDE is complaining about not finding any autowire candidates.

Very interested where you'll go with this video. We oftentimes use Spring Boot for our web services. I think it's very powerful but on the other hand oftentimes hard to comprehend because it is so implicit about things and of all the magic it does. A simple example of this is the main function, which gives no clues whatsoever about what will be executed; at least without using the IDE hints. I really was looking forward to Spring (Ko)Fu but sadly the project came to a halt.

For our newer projects I aim to not rely on any Spring functionality for the "core" / "domain" of the application. Which works pretty good so far, oftentimes reducing test times and helping to avoid the use of mocks. Only for pure technical stuff, like exposing GraphQL endpoints or database access, I still rely on the powerful capabilities of Spring.

I personally would love to use a more declarative and explicit framework, but there's a lot of Spring knowledge in the teams which makes it hard to argue with.

JentaroYusong
Автор

Dmitry and I came to the conclusion that Spring Boot constitutes a language on top of Java or Kotlin, so that refactoring from it to Kotlin is legitimate. What do you think?

PairingWithDuncan
join shbcf.ru