spring crud restful web services

spring crud  restful web services

hi i am going to show how to create a spring crud with restful web services

this tutorial has prerequisite  on how to create a spring  creating spring project structure in eclipse

you can download the project from google drive

also download the spring jars from my goole drive only because i have used some other libraries.


for compilation i had used

1. tomcat 7
2. java 8
3.PostgreSQL

we are not using jdbc instead we are using ibatis (ORM)

before importing the project install PostgreSQL 9.4 and create a table that is given below

CREATE TABLE javatospring.student
(
  myname character varying,
  fathername character varying,
  mobileno character varying,
  email character varying,
  gender character varying,
  address character varying
);
use same name as it is given

you can see the video on how to create a table in postgres using pgadmin in the below video.


now import the spring crud project into eclipse go to build.xml file in the spring project structure

<project basedir="." default="war" name="springcrud">
    <description>Application build file</description>
    <target name="war">
        <mkdir dir="dist">
        <war destfile="dist/springcrud.war" webxml="web/WEB-INF/web.xml">
            <fileset dir="web">
            <classes dir="web/WEB-INF/classes">
        </classes></fileset></war>
        
        <copy flatten="true" todir="E:\software\tomcat\webapps">
            <resources>
                <file file="dist/springcrud.war">
            </file></resources>
        </copy>
    </mkdir></target>
</project>
now replace todir="E:\software\tomcat\webapps" with your tomcat webapps folder.

now to run the application right click on the build.xml and run as ant built.

note: Run your tomcat server before building your springCrud application.

after the build is successful you should go to browser address bar type

localhost:8080/springcrud . you should see your application running.


sprign crud

spring crud sample output

you can add,delete ,update,show like the above output.