An example project based on SpringBoot integrated with oauth2 ( token persisted on mysql ), swagger2, restful API, druid, mybatis ( generator and pagehelper included).
install plugin
lombok
if you are using IDEA
Create mysql database named
seed
bydb/schema.sql
&db/data.sql
, then Run SpringBoot Application
see
http://localhost:8000/druid/login.html
username
root
and passwordroot
is same as mysql database
run
mvn mybatis-generator:generate
see
http://localhost:8000/swagger-ui.html
use
curl http://localhost:8000/oauth/token -X POST -u client:security -d "grant_type=password&username=admin&password=adminadmin"
to get access token, for example :69aaaeb8-49c2-410d-8253-ad6c003c6091
then we can use
curl -X PUT -H "Authorization: Bearer 69aaaeb8-49c2-410d-8253-ad6c003c6091" --header "Content-Type: application/json" -d "{ \"newPassword\": \"new\", \"oldPassword\": \"admin\"}" "http://localhost:8000/user/password"
to modify password
also
curl http://localhost:8000/user/1 -X DELETE -H "Authorization: Bearer 69aaaeb8-49c2-410d-8253-ad6c003c6091"
to access other authenticated url
https://github.com/ustcwudi/SpringBoot-Seed-Service
https://github.com/ustcwudi/springboot-service
https://github.com/ustcwudi/vue-seed