r/learnjava • u/hoy83 • Aug 10 '20
Whats is spring/spring boot?
Sorry just a newbie question.. but I was wondering if someone can explain to me in simple terms what spring/spring boot is. I mainly use Java to program desktop apps using swing and mysql as the database. Is this in any way related to what I'm doing? I've been reading on google that it's a framework but I still don't understand what it does. Is it something that helps in developing web apps? Any help would be appreciated thanks.
3
u/snot3353 Aug 10 '20
Spring is a set of a projects and libraries that provide many different capabilities. The most well known are the Spring projects that provide Dependency Injection (AKA Inversion of Control), Web Frameworks and Aspect-Oriented Programming (AOP). There are many beyond this though.
Spring Boot is a project that sits around some Spring Projects and provides Autoconfiguration, Starters and Actuator. It is used to make getting started with Spring projects easier by letting you indicate what you want to do and then automatically using default configurations (until you replace them). Since many Spring projects are complex and have many features, it can sometimes be difficult to get started with them if you have to know how to configure everything up front from scratch. Spring Boot is intended to ease this.
0
Aug 10 '20
[deleted]
1
u/hoy83 Aug 10 '20
So its for programs that are online and use the web mostly?
1
Aug 10 '20
Yeah. Like websites etc.
1
u/hoy83 Aug 10 '20
Do you use a front end language in combination with it like html/css and javascript?
0
Aug 10 '20
Yeah. In works in combination with angular or any other front end languages/frameworks.
1
u/hoy83 Aug 10 '20
Thanks.. so technically it is a back end language then..
1
u/Yithar Aug 10 '20
Spring isn't a language. It's a framework. Java is a language. Also, with Thymeleaf, you don't need to use Angular or React. But most projects use React or Angular rather than Thymeleaf.
0
2
u/Yithar Aug 10 '20
No, it doesn't need to be a web app to use Spring. ABasit106 is wrong. That's why he has so many downvotes.
https://www.baeldung.com/inversion-control-and-dependency-injection-in-spring
Spring's core functionality is Inversion of Control and Dependency Injection.
69
u/FrenchFigaro Aug 10 '20
Spring is an application framework whose core concept is dependency injection, which means that, as long as you use the proper declarations in your code, Spring takes care of the initialization of the various components of your app.
A framework is basically a skeleton app that can be used to concentrate on the actual problems your application is supposed to solve, rather than the meta-problem of building a functional application before putting your business code in it.
Spring can be used to develop desktop programs, but it's not its main area of usage. As someone else pointed out, it's mostly used for back end applications (web services, mostly). Spring MVC can be used to create stand-alone web applications using JSF or ThymeLeaf.
Spring is configuration heavy, which is where Spring Boot comes into play. Boot is an overlay over Spring, and it's (mostly) a collection of default configurations for Spring components, that helps you start a project more rapidly by allowing you to configure components only if you need a configuration that's different from the default. There's actually a bit more to it, but that's the main idea.
Boot is used a lot in webservices environment, because it allows to embed a server container inside the application and have it run as a stand alone, rather than having to deploy it on an external server (like tomcat, or glassfish, or whatever). Which is great for dockerisation (among other stuff)