This interview is an excerpt from The Confident Spring Professional course.
Marco: Hi Maciej! Would you mind quickly introducing yourself?
Maciej: Hi Marco! I am a freelance software consultant specialized in Java/Kotlin and Spring.
I run the Spring Academy YouTube channel with video tutorials & news from the ecosystem addressed to intermediate Java & Spring developers. Since May 2020 I maintain and develop Spring Cloud AWS project.
Marco: Since when do you program with Spring and how did you get into it? Do you still remember your very first Spring project?
Maciej: I got into Spring and Java in general by accident. Since high school, I have been working with PHP and my first software development job was building a CRM application in PHP. I was 20 years old, the company was tiny. I was learning a lot, but I felt like I could learn much more working for a "real" software company in a proper office, working with a team.
I got involved in a student program project funded by a local company - BLStream (today Intive) - we were building a platform where users during events could post photos from their mobile phones. I imagine it doesn’t sound very innovative today, but it was 2006 (!) so even before the iPhone was created.
The technology stack they chose happened to be Java 1.5, Spring 2.0, JSP, Hibernate and Postgres or MySQL. For someone like me - new to the ecosystem, the beginnings were tough - there were not that many tutorials back then, no video courses and buying international books was completely out of my range.
Somehow we did it and together with my friend we got hired by BLStream when the project was close to being finished. I have been working primarily with Java and Spring since then.
Marco: For people new to the Spring ecosystem, what Spring projects would you recommend having a look at and in which order? Why?
Maciej: I recommend starting learning the fundamentals of Spring Framework and Spring MVC so that it’s clearer what is happening under the hood when working with Spring Boot.
Once you understand the Inversion of Control container and the programming model it becomes relatively easy to get into other modules and they can be learned almost on the spot.
Marco: What would you say is the one thing where most developers go wrong with Spring?
Maciej: It’s probably more general than Spring developers issue - too many developers try to get answers quickly from outdated or questionable tutorials, StackOverflow answers without reading the official documentation.
Spring has great docs and while it may feel overwhelming to go through them, it is definitely worth it.
Marco: Would you still invest time in learning Spring based on servlets and JDBC, or go straight into reactive Spring?
Maciej: Reactive paradigm while it has a lot of potential and it’s an elegant solution for certain types of problems - in most enterprise business applications these problems do not exist.
You can get really far with traditional servlet based programming model and what’s important - everyone around is also familiar with these technologies. It’s definitely worth learning WebFlux and reactive Spring so that you can use it when there is a use case that can benefit from reactive paradigm but I recommend learning traditional servlet stack first.
Marco: With the advent of client-side frameworks (React, VueJS, Angular), what’s your take on writing web applications with server-side template rendering, like Thymeleaf? Is that now legacy?
Maciej: When developing front-end what matters is a fast feedback loop - you need to be able to see the changes you’re making in order to proceed further. With traditional server-side Java applications it has always been a pain. Yes, Spring Boot has support for Thymeleaf live-reload, but everything else - CSS pre/post processors, frontend dependencies via WebJars - feels like gluing things together and hoping it’s going to work.
Modern front-end frameworks' programming models let developers build reusable components and avoid CSS clashes thanks to CSS-in-JS or CSS Modules. I believe that client-side framework used properly can significantly speed up the development.
Thymeleaf has not been actively maintained since 2018. Wro4j which aimed to address some of these issues is also pretty much dead. If Spring offered first-class support for building server-side rendered full-stack applications I would be very happy to use it. Today unfortunately it’s just pragmatic to use one of the client-side frameworks or Vaadin.
Marco: What is your favorite way to connect your Spring application with a database? Would you recommend plain JPA? Hibernate? Spring Data? Any other of the 500 available choices?
Maciej: The correct answer is "it depends" so I’ll answer which one of persistence technologies sparks the most joy - it’s Spring Data JDBC. It’s simple, opinionated, there’s not much magic, does not try to abstract too much, but on the downside, it’s also limited in functionality.
When I find these limits are a deal-breaker I go with Spring Data JPA but I can’t say I enjoy it much.
Marco: There are some misconceptions that Java or Spring might be slow, bloated or simply too legacy. What do you think about other choices, like Micronaut, Quarkus or even other languages like Kotlin or Scala?
Maciej: I am very happy Spring finally got strong competitors like Micronaut and Quarkus. I haven’t used them in real-world applications but even based on something a bit more complicated than hello world you can tell the difference in speed. They are really fast!
While I don’t think production startup time matters as much for the majority of applications, it does make a difference when running integration tests. The faster startup time - the more integration tests developers are willing to write. Spring is not slow, but it could be faster indeed and I am happy that the Spring team felt a bit of pressure to put more effort into this aspect too.
Regarding other languages - I’ve been using Kotlin for a few years now and it is currently my language of choice when creating new applications. The only thing in Kotlin that bugs me is the compilation time or rather how slow the IDE becomes during development, running tests etc. I have high hopes for the new Kotlin compiler that is meant to be released in 1.4, but let’s see how it goes.
Marco: Is there something you would say that Spring could do better and needs some improvement?
Maciej: There are few things that I think could be better - some of them we already mentioned - integration test execution time and first-class support for building frontend applications. I also think that Spring Security could be simpler to use. I don’t have anything specific in mind but I know that people in general struggle with it.
Marco: What is the best way to follow you and learn more about your work and what you do?
Maciej: The best place to find me and get in touch is Twitter - @maciejwalkowiak. I run a YouTube channel https://www.youtube.com/springacademy - but I struggle to get back to making videos after a year of break. Not that long ago I set up a personal site http://maciejwalkowiak.com/ so if you want to learn more about me check it out.
Marco: Thank you, Maciej!
There's more where that came from
I'll send you an update when I publish new guides. Absolutely no spam, ever. Unsubscribe anytime.
There's more where that came from
I'll send you an update whenever I publish a new guide.