Spring Boot Diary: What is Spring Boot?

No Comments

I’m starting this series of Spring Boot articles to shed the light on one of the best (if not the best) frameworks out there to develop not just a web application, but any kind of application.

So what is Spring Boot? You can go online and read all those fancy descriptions and lines out there but if you want the short answer, it’s a fucking cool framework to make things in a really easy way, super easy, you don’t need to think, it thinks on your behalf, you don’t need to configure anything, it configures itself on your behalf, you don’t need to remove any obscurity, it’s already clear, it’s a super duper tool to build things in an easy, fast, and perfect way.

Why should you use it? Because it’s awesome. Wanna know why? Let’s go here.

You will see something like this:

 

 

So what is this? This screen will build everything for you, you don’t need to deal with any kind of shit, just write the name of your Maven group and artifact and pick your dependencies.

Now ask yourself, what do I want? I wanna build and deploy a web application that contains a page displaying Hello World. That’s it? Ok, then just add the web dependency and you’re done!

 

 

Generate the project and import it to your favorite IDE, in my case, it’s Eclipse and not IntelliJ, and here it is imported into my awesome IDE with a single class that has been generated by Spring Boot called Application.

 

 

So what’s the purpose of this class? It’s everything you need. That’s it! That tiny little famous main method containing that cute single line is EVERYTHING you need. You’re done, you did it, you got yourself a web application, you don’t believe me? Just run it!

But wait, we didn’t do yet the Hello World part, just add a simple index.html page in the static folder under resources (these folders are already created by Spring Boot).

 

 

Now start the app and the console will display the following beautiful lines:

1
2
3
4
5
6
7
8
..
Tomcat initialized with port(s): 8080 (http)
..
Starting service [Tomcat]
..
Initializing Spring embedded WebApplicationContext
..
Tomcat started on port(s): 8080 (http) with context path ''

What does that mean? Tomcat is started on port 8080! But where the hell did it come from? I don’t remember instructing you in this wonderful article to download it! Well that’s Spring Boot! The server is embedded right into the application, you don’t see it, but it’s there…

Ok so what now? Let’s check it! Open this.

 

 

And that’s it! You just built a web application in a 1 minute, you actually made much more than that but we will leave the details for another article!

Wondering what you can do in 3 minutes? You can actually build a Microservice, you don’t believe me? Here it is.

 

 

Categories: Java, Spring

Leave a Reply