loading...

The beginner's guide to Spring Boot

skuzzle profile image Simon Taddiken ・2 min read

Disclaimer: This article probably seems shorter than you have expected regarding its title. In the end you will have learned that it's not.

Spring Boot is the one big player in the market of available java application frameworks. Everybody is supposed to know Spring Boot and how to write applications using it. Yet, you see so many Spring Boot applications that have gotten out of control and are a nightmare to maintain. Why is that?

In my opinion, this is because it is so easy to get started - you put an annotation here, you put an annotation there and voilà you have your REST service running. But then, it is not quite as easy to evolve and structure your application correctly if you are not aware of some key concepts and some of the stuff that is going on under the hoods. Without proper understanding, it is way too easy to screw things up. Examples?

Application context configuration seems easy at a first glance but can get rather complex while your application grows. Do I use component scan or java based configuration? Can I mix them? Where do I put those config classes? Is a single @Configuration class enough? What is this 'auto configuration' actually? If you can not properly answer these questions in context of your application's requirements you will end up creating an unmaintainable ApplicationContext hell.

There are other examples like scopes, logging configuration, property sources, AOP proxies, dependency management, bundling, profiles, web security and whatnotelse.

In short: If you thought that writing an application using Spring Boot is as easy as putting @SpringBootApplication on your main class, you are wrong. It is just as easy to screw everything up if you have no idea what you are actually doing.

So here is my advice if you want to get serious with writing a Spring Boot application: RTFM

(Really, that is the single most important resource to learn how Spring Boot works)

Posted on Mar 13 '19 by:

skuzzle profile

Simon Taddiken

@skuzzle

I've been a Java developer for more than 10 years. During this time I developped a strong sense for best practices and beneficial structures and patterns in software architecture.

Discussion

markdown guide
 

I agree with your analysis and I think that Spring Boot is not the best way to learn Spring. I see it more as a way to help Spring developers to go faster when they bootstrap their Spring application. Indeed, without prior Spring knowledge, you end up doing pretty nasty stuff...

 

A guide which tells me nothing but everything I already knew.

Very helpful. I am thrilled for you being in the community.

 

Even constant RTFM does not guarantee lack of nasty surprises with Spring. Eventually comes understanding that use of Spring is counterproductive.

 

I agree as well. deploying a spring boot project as is, is good for quick development but will take some more configuring and tuning before throwing it in a prod-like an environment.