Recently, I got exposed to creating backend APIs and services using Java, more specifically, Springboot. This was something I didn't think I would enjoy, as it felt somewhat archaic in a way. Part of this was probably because of the stigma that Java has in my region, where it's considered old and redundant similar to C#.
However, after just browsing the guides and building a microservice with Springboot over the past week, I can confidently say that it has been a great experience, with very functional libraries included that make the lives of us developers so much easier. The guides have been nothing short of informative, instructional and easy to follow, especially coming from a beginner's perspective to Java programming.
C# users, brace yourself for a formidable, EntityFramework-esque rival.
Pros
1.Much like EntityFramework, interacting with a SQL database has never been easier.
Simply make use of either the CrudRepository or JpaRepository (based on your required specifications) and create your own repository, which serves as Entities (not to be confused with Models, which layout the schema/fields of your tables)
From here, you're able to add your SQL queries in order to retrieve specific information, and even join tables using the models you defined!
2.Writing to the database has also been made easy!
Simply pass the record that you want to save to the table in the entityName.save(recordHere) method!
If you need to do bulk inserts, use a data structure such as a ArrayList to store all of your records first, before passing it to the saveAll() method instead!
These are just scratching the tip of the surface of understanding the world of Springboot, Java programming and Microservice architecture.
I hope to share even more tips and insights like this in the upcoming weeks and months, and stay tuned for more articles & leave comments regarding these topics so we can all learn together as a community!
Top comments (0)