This is a simple demo on implementing a RESTful service with Java Spring and AngularJS.
The demo takes the mean-template and replaces Node and Express with Spring. The used database is still MongoDB.
The demo is built in the spirit of Spring Guides and Spring Boot:
- The application can be "just run", i.e., additional environments (like Tomcat) are not required, except MongoDB.
- The configuration is based on Auto-Configuration and annotations (no
web.xml).
For MongoDB, the used database is "mean-template-3", collection "userlist". This is inline with mean-template, so the environments cam be run against the same database/collection.
A couple of changes were required to the Angular part:
- The logic how Spring handles MongoDB
_idwas not clear. Spring sendsidinstead of_id, and there was no success in trying to change that behaviour. paramswere added todeleteUser(Users.js). Not clear why the original example is functional without this.
Install MongoDB. Start the daemon.
Use Maven to build the Java application:
$ mvn package
Start the application:
$ java -jar target/jng-template-3.0.jar
Go to: http://localhost:8080.
- v.3.0:
- Introduced
application.properties, configures the name of the database. index.htmlto show the version number frompom.xmlvia Maven resource filtering.- WARNING: instability with Maven builds in STS, sometimes the application works, sometimes not. Root cause unknown.
- Introduced
- v.2.0: Added guidelines for running from command line.
- v.1.0: The first functional version.