Restful API Server
Before working on Ionic UI, let’s setup the restful API server first, you can follow “Spring Restful + Hibernate with AngularJS” to setup the restful server.
Or, you can download SpringRestfulExample for Tomcat server and Spring4Restful_v01_schema.sql for MySQL database. Then, you can follow the below procedures:
- Install JDK from Oracle (using JDK 1.7 for our example), you can download from http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Setup JAVA_HOME path
a. Right-click on “Computer”, and click on “Properties”.
b. Click on “Change Settings”
c. Click on “Environment Variables”
d. Under “User variables for XXXX”, click on “New” button to create a new user variable
Input “JAVA_HOME” as variable name and C:\{your_java_installed_path}\jdk1.7.0_55 as your variable value. If you are using different version of JDK, please update the path value.
- Download and Install MySQL (using 5.7 for our example) from http://dev.mysql.com/downloads/mysql/
- Import Spring4Restful_v01_schema.sql into MySQL
- Download and install Tomcat (prefer Tomcat 8 or upper) from http://tomcat.apache.org/download-80.cgi
- Place the SpringRestfulExample folder under C:\{tomcat_installed_path}\webapps\
- Start the Tomcat server by running C:\{tomcat_installed_path}\bin\bat
- Tomcat will extract the war file and install
- Done, you can try this URL: http://localhost:8080/SpringRestfulExample/shop/
- If you see the below screen:
- Please stop the Tomcat, and update the connection.username and connection.password of C:\ {tomcat_installed_path}\webapps\SpringRestfulExample\WEB-INF\classes\application.properties . Then, you should be able to see the JSON data when startup the Tomcat again.
Right now, everything is ready. Please see the next blog for Ionic UI examples.