Let us start the SPRING…

Hello Again..

It’s coding time now…and let us do some JAVA coding first then we will “Springify” that code using Spring Framework. It is a simple Java program with classes, interface, main class to bring together all classes to work as one application.

What will we do….

I know you guys will be sad because I promise to have some spring codes, but trust me staring with Springs right away will not that interesting…

Some Prerequisite…

  • IDE : I will be using STS. (SpringSource Tool Suite).
  • Knowledge of Java
That’s it for now..
Let us create a simple Contact Manager Application.
  • Create a Java Project (File -> New -> Java Project)
  • Create a Package “com.springwelcome.model” and inside that create a class “Contact.java“. Here we are going to define what we need to store in as contacts. It is a simple POJO class with FirstName, LastName and PhoneNumber.
  • Let us now create another package that will contains the method dealing with data for Database Transactions. Here we are not going to use any database instead we will be using List to store information and return to our Service class. 
  • For this create a package “com.springwelcome.repo” and add a new class “AddToContactImplementation.java“. You must be wondering why am I used …Implementation. Yes, I will using an interface. Let me add the code to make it clear. 

  • Here the question arises why are we using interface here, where we can use the class name directly while creating the instance. You are absolutely correct. In future we are going to learn about spring and we are going to convert this application using springs. In Spring we have an important concept “Inversion Of Control”. Lets move into this later….
  • As we have the Data Storage Class A.K.A. DAO (Data Access Object). To know more about  DAO please follow the link. Now let us create the service which will return us the names in the contact. 
  • Let me create a new package and name it as “com.springwelcome.service” and create a new class inside it as well and name it as “ContactService.java“. 
  •  Similarly we will be implementing an interface here as well. 

  • Now we are almost done with all the parts of this application, We just need to bring together all parts into one. Let us create a new class without any package and name it “ContactManagement.java“. This will contain the  entry point for out application. the MAIN class. 

That is it..we are done with a java application which will be SPRINGIFY soon..

    Hoping you get along with this easily…till next time when we will be doing some changes to implement springs…
    Happy coding.. 🙂



    … Why SPRING ??

    Hello Guys,

    As already mentioned, Spring is very lightweight and to make it more light it runs on a web container like Tomcat, and to make it lighter for developers it simply based on POJO (plain old Java objects). Even one can create a simple application with simple POJO and some spring configurations.

    Springs came to picture as an alternative to the existing Java EJBs due to the fact that EJB applications has huge problem while maintaining, lack for testing functionalists takes away the first and strong line of defense from developers, adding and removing modules into the old application was very very difficult as they are tightly coupled with each others. With these the added pressure of dealing with the complexities in code do not let developers to concentrate on the core business logic.

    Springs provide greats solutions to all these problem…

    • Testability
    • Maintainability
    • Scalebility
    • Handling complexities with ease
    All together, these makes our life easier and force us to fall in love with SPRINGS at first place. We can now concentrate more on the development of application with the business on mind not with the complexities of coding. We can now handle the exceptions while it still in making not at a point where it became a monster and start punching and kicking us with powerful exceptions. 
    From requester’s perspective, when they need something and ask for that they want that need as final product not the steps followed to make it or make it safe or make it better. On this SPRINGS becomes a huge relief for us to provide requester what they need.
    Now aren’t you in LOVE with spring ? I am now for sure as I am sailing ahead and much interested to get into it ASAP. I know you too and want to see some codes. For us life without codes are boring.

    I promise in coming series will try to get started with our first application…

    Thank you,
    Sovan Misra

    How SPRING ? Why SPRING ?

    Hello Folks,

    Welcome back!! Welcome aboard !!

    Just to shake your brains, lets have a recap of the what I am doing here…

    My plan is to “KnowMore” about Springs Framework and share my understanding and gain knowledge from experts and gurus on my way. Its as simple as that.

    But before I start understanding the core, thought to know HOW springs came into existence and WHY it is still so lovable for developers across the world ?? Any guesses..?

    No..!! Yes..!! Its a framework..!! Easy to write code..!! Easy to build application..!!
    Yes, Exactly.

    Before I start sharing the WHY it still the “Love Of Developers”, allow me to explain in brief HOW it came up ?

    Before 2002, we have JAVA EJB,  EE Applications which were in market for quite a long time. But with evolution of developers, so evolve spring as a product which is very LIGHTWEIGHT and runs on a web container e.g TOMCAT not in application server, Simple java POJO based development(I hope that all Java geeks will be here on board…)

    First milestone release came in 2003, then on an average of 15-18 months, springs upgrade itself..with 2004 comes the Spring 1.0 version. By 2006 it releases Spring 1.2.6 and by fall of 2006 Spring 2.0 was released. About 8 months later spring 2.5 was released with a enhancement of using Annotation for configuration and XML configuration (please wait it is coming in soon). This trend move on with 3.0 in 2009 and the current stable version is 4.0 which supports Java SE 8, Groovy 2, and whole lot of things…

    Now WHY ?

    Well!! I keep it to the next in this series…

    Thanks for being with me..

    Sovan Misra

    Before the start…

    Hi folks,

    This is going to be a unique experience for me , for you , for all who are going to follow this series of blogs on springs. I can tell you, this is going to be a completely different form all existing blogs sites in web.

    Surprise ??

    If I say at this point of time I DO NOT KNOW ANYTHING ON SPRINGS FRAMEWORK…. now what…more SURPRISE.. :O  !! Yes that’s true, at this point I have no idea on spring framework apart from the fact that it is a Java Framework and is being widely accepted by world of developers.

    Now some thing about me, don’t want to remain an alien for so long…before you kick me off your browser.

    I am a software developer by profession and have been in this industry from last 3 years. I have been working with a great tool “SERVOY”. Servoy is a RAD tool which has very cool features that makes our life  so easy and fast that you can build a complete working application for rich/smart/desktop client, web client, mobile client and connect to any databases and generates reports and making it fully tested and what not with 60% less time than any programming language. Cool hann!!

    Okay! Back to Springs…

    There is something that fascinates me..which kinda allure me to “KnowMore” about this. So here is the plan.

    I will start learning and going to share it here instead of maintaining personal notes. I am sure..aa..a…in fact hoping that some visitors would be SPRING GURUs and help on this way of learning it, I am also sure some new learner will also visits and share their knowledge as we move on this voyage. I am not hoping this voyage would be calm so we will not face any problems..but instead I hope it will be rough, so our experts will guide and correct our mistakes along we sail ahead.

    Welcoming all aboard ship “KnowMore – Spring”.

    Sovan Misra