Álvaro Mateos What is Spring Framework?
I’d like to point out that this article is a totally subjective perspective, I’m, simply sharing my point of view as a developer at Aurigae – Cashware about a work tool that forms a part of my daily working life. I am not in any way whatsoever trying to convince or influence anyone about the use of Spring Framework.
I have six years experience as a back-end Java developer and I’ve been working for two with Spring Framework as a Java support. Having said all that, let’s get down to business.
What is Spring Framework?
I’m going to try to explain what Spring Framework is in my own words without getting too technical. Basically, Spring is a framework that goes beyond Java and consists of tools and utilities that help the developer to create web applications in Java for the back end. To my mind, its main value is its capacity to generate automatic code for standard tasks, such as access to data bases, endpoints, etc.
It is especially valuable when developing applications and inversion of control containers. It is open code for Java.
Although the main features of Spring Framework can be used in any application developed in Java, there are a number of extensions for building web applications on Java EE. This framework has become popular once again because it is regarded as an alternative to the EJB model.
I have found these benefits in my daily work with Spring Framework
I’d like to focus on those points that I like the most and that I feel provide the most value in my day to day work.
In my opinion as a developer, the value of Spring resides in the versatility of the framework, in other words, Spring is divided into different modules and each of them can help us with different needs. To give an example, Spring Framework is especially useful when lines of code are reduced, it has the Spring-Core module to do this. When we talk about reducing lines of code, we’re talking about something that might need 50 lines, and Spring Framework can let you do it in 3. Perhaps the best example of savings on lines of code is the initialisation of instances of classes and the dependencies between them, because when you do it automatically these are lines that you save.
Another good example is web development on REST API, in this case Spring Framework manages the request, analyses the type of data and decides what class of Java has to work to process the data. I’ll try to explain all this with a practical example. The REST API module (Spring-mvc) helps me as a back-end technician to work with the support of the front-end technicians. So, when I have to make an end point in a URL, the front developers can call this end point and it’s Spring Framework that goes to the call, collects it, decides what class can process the information, executes the class, processes the information and sends it back to the front. From a development point of view, that’s not just a timer saver, that’s a great help.
The features that I’d like to highlight include security, which is a vital element to be borne in mind. Spring-security manages the security of the web in a simple manner, from the security protocol, to the roles needed by users to access the application resources.
There are other interesting modules such as the object visibility and management configuration, or the transactions management, which unifies different management APIs and coordinates transactions for objects. There are several others that I haven’t included in the list that make Spring Framework well worth it.
Features to bear in mind when using Spring Framework
Since not everything in life is black and white, there are some points that should be borne in mind if we want to invest in learning Spring Framework.
Firstly, the configuration. This can be broken down into two main types, annotations or configuration files. It’s true that configuration via annotations is a bit simpler, and configuration via files is somewhat more complex. Such complexity can mean that the number of errors is often high. You resolve an error and advance, but it’s not unusual for new errors to appear after that, and that makes the framework a complex one.
Some of the most common errors I’ve found are that it does not gather documentation, or that it’s not reading a file well, or problems with paths and class dependencies that it does not find.
To offset this point, it’s important to know that there is a lot of documentation in this regard that can help us, but the implicit payback is that you’re the one who has to filter and understand the documentation.
My advice is that if you want to learn Spring Framework, a good way would be to start with reading general documentation and see a lot of videos on the subject before starting to to work with the tool, I think that way a lot of frustrations can be avoided.
Bear in mind that mastery of this framework is no easy matter. Although starting to use it is not an insurmountable challenge, it’s certainly not like starting to use Play framework. If you want to be proficient in Spring Framework, it’s worth remembering that it’s not a short-term objective.
It’s true that you can learn it quickly, but if you want to make it really work well with good configuration, that’s not so simple.
When I do not recommend using Spring Framework
It’s important to remember that Spring Framework creates lines of internally self-generated code, that means that the precision of the code shall never be so fine as the one created via a developer. In other words, the purity of the code is affected by using Spring.
For this reason, there are two very specific cases when I would not advise the use of this framework. Firstly when the project is very small. In this case it’s important to assess if configuring Spring might take you more time than you think you might save by using it. Secondly, from the point of view of project efficiency. We said that Spring will help us to be much more efficient in our work, but our work will not be more efficient by using Spring because of the self-generated code we mentioned above. For that reason, if we need to generate a project where each process cycle is important, I think it’s better to do it manually.
Job opportunities generated by Spring Framework
Before going into the issue of job opportunities, I’d like to remind readers once again about the subjective nature of this article, everything said here is based on experience, not on data.
Having said that, I have to confess that in my opinion Spring is generating a lot of job opportunities. Proficiency in this framework is a clear differentiating element amongst developers because it means working with a plus in efficiency and order in coding.
I know that when recruiters and head-hunters knock on my door, 60% of the time they place special emphasis on the level of proficiency in Spring Framework.
After all, using Spring is linked to cleaner, simpler and more efficient work, so why not use it?
Finally, I’d like to offer you some conclusions to summarise the article. I hope my perspective has helped you.
- + Helps in reducing large quantities of lines of code
- + Also facilitates data base management
- + Especially useful when developing web services on REST API (Spring-mvc)
- + Large number of libraries and modules available
- + Reduces development times
- + Helps to give flexibility in the project
- + It’s a very wide-ranging tool, made up of relatively independent modules
- – Proficiency in Spring Framework takes time
- – Proficiency in all the modules is a complex process