Skip to main content

A noob Introduction to Spring and Spring Boot Frameworks

How many of you guys have heard about Spring and Spring Boot frameworks? If you are a so called "Java guy" , you'll probably have heard and might have even worked with these two frameworks. In this blog post I'll give you all a brief introduction to these two frameworks , including a comparison between these two. In the latter part of this post I'll show you how to create a simple Spring Boot application in 5 minutes.


So what is this Spring Framework? Spring is actually a very popular application development framework for the Java platform, specifically useful in developing enterprise Java applications.
 There are several reasons behind its popularity among the Java community:
  • Inversion of Control
  • Aspect- Oriented programming 
  • Data Access 
  • Transaction Management
  • Model-View-Controller architecture
  • Remote access framework
Despite all the above mentioned features spring has become mostly famous for Dependency Injection(DI) with the favor of  Inversion of Control(IoC). What does IoC actually do? IoC provides a consistent way of managing and configuring Java objects using reflections( ability of a computer program to modify its structure and behavior at runtime). Dependency Injection is actually a specific type of IoC where we pass objects by name to other objects using either constructors , properties or setters. Together DI and IoC helps to build loosely coupled systems. During implementation these dependency injections are added with the annotation '@Autowired' which lets spring know that injections are required.


Now lets have a look at the Spring Boot Framework. Spring Boot framework was developed on the existing spring framework. As we discussed above , Spring having so much great features and being very popular among the developers , what made people to use Spring Boot over the Spring framework? There were actually a few shortcomings of Spring framework which caused the emergence of the Spring Boot framework. With the Spring framework following problems were encountered :
  • Lot of configurations and boilerplate code to manage
  • Bootstrapping the project involves a lot of time
  • Harder to integrate frameworks and libraries
  • No clear support for microservices
Spring Boot uses a new development model that makes developing Java applications very easy by avoiding some tedious development steps and configurations. It also brings in several features that solves the above mentioned problems with Spring framework:
  • Convention over Configuration.
  • Standardization for Microservices.
  • Integrated (embedded) server for development.
  • Support for 3rd party libraries.
  • Easier integration with other frameworks
Spring Boot provides lots of starter packages and plugins to develop and test Spring Boot applications very easily and quickly using build tools like Maven and Gradle.

Creating a Spring Boot application using Maven just in 5 minutes
1. Go to the site https://start.spring.io/. Following window will be displayed


2.Type in the name of group (package name) and artifact (project name). At this stage no need to add  any dependencies because all the dependencies will be automatically downloaded  by Spring Boot. Then click Generate Project button.
3. Once the button is clicked a zipped project will be downloaded to your PC.
4. Extract the project folder inside the zipped folder to a know location .
5. Open a suitable IDE (ex: Eclipse) and import the extracted project folder.(Note: This might take a while as there are a large no.of maven and Spring Boot dependencies to be downloaded). Once completed it will look as follows:



6. Run the selected source file (as in the above picture), and see the output.
    
This is only a brief introduction about the basics of Spring and Spring Boot frameworks. Actually the most exciting features of these frameworks lies further beyond. So if you are interested in learning more, there are a huge number of tutorials, documentations and etc up there on the internet, where you can learn to be a expert on these frameworks.

Comments

Popular posts from this blog

How to get started with MongoDB

In my last post I gave you all a brief introduction about NoSQL databases and its uses. As I mentioned in my last post , in this blogpost I'll give you all an overview of MongoDB and how to get started using MongoDB. Basically MongoDB is a document-oriented, NoSQL database and it can be rated as the most popular and widely used NoSQL database. MongoDB is free and open source , therefore anyone can simply download it from their site and start using it in their applications. It stores data as JSON(JavaScript Object Notation) like documents with schemas. In fact, data is actually stored in MongoDB as BSON objects. BSON is very much similar to JSON except that it is the binary representation of JSON. Unlike JSON, BSON is optimized for performance and navigational abilities. Typically data will be stored in the format shown on the following picture.  Key features that had contributed to the huge popularity of MongoDB are as follows: Support Ad hoc queries together JavaScript ...

A comparison between Node and Express

If you are programmer who have worked a long time with JavaScript you might know that , earlier JavaScript was just a scripting language used in the client side. However now the story is different. With many libraries like Node js and Express js being added to the JavaScript family JavaScript have evolved beyond, just being a scripting language in the client side. With these new libraries being added, now it is possible to build entire sites on JavaScript, extending it from front to back-end seamlessly. So what is Node and Express? Let's  clear this out step by step! What is Node js? Node js is an open source JavaScript runtime environment that executes JavaScript code server side. Node enables developers to use JavaScript for server side scripting. Node uses an event driven, non-blocking I/O model that makes it light weight and efficient. Because of this model Node js is particularly useful in web application that have many input/output operations and for real time web appli...

Difference between callback functions and promises in javascript

If you have ever worked with JavaScript you might have the experience that it is a quite confusing language to understand at first. This is because  in JavaScript there are many ways to do the same thing, and also unlike most other programming languages, if you do a small mistake in JavaScript instead of giving any errors, the program would behave in a totally different way than what you expect. Therefore, without understanding the basic concepts of JavaScript, it's quite difficult to work with it. In this post I'll be explaining about callback functions and promises, what they are used for and the difference between the two methods. Actually callback functions and promises are 2 different ways of doing the same thing. By default JavaScript is an asynchronous programming language. Which means that JavaScript does not execute instructions line after the other as in many programming languages. Whenever JavaScript come across an operation that takes relatively a long time, typic...