THIS SAMPLE APPLICATION SHOWS SEVERAL USEFULL FEATURES:
- spring boot
- spring security
- spring data rest
- MockMvc
- mysql/h2 (dev/test) use
NB: main rest services feature could be seen through:
- tests (RestControllerTest.java) no external db is needed
- or using external mysql db; sql scripts could be found here:
/spring-boot-ex2/src/main/resources/static/db/ ...
APP RUN
- mvn clean package
- if using external db, set mysql and run db_structure.sql and insert_roles.sql
java -jar target\spring-boot-ex2-0.0.1-SNAPSHOT.jar
TESTING WITH CURL
curl -H "Content-Type: application/json" -X POST -d '{"id":null,"email":"[email protected]","password":"password2","name":"user2","lastName":"lastName2","active":1,"roles":["ADMIN"]}' http://localhost:8080/registration
curl http://localhost:8080/user
curl -w "%{http_code}" -H "Content-Type: application/json" -H "Authorization: Basic dGVzdDJAdGVzdC5jb206cGFzc3dvcmQy" -X POST -d '{"result":"process me, please"}' http://localhost:8080/process