An example project based on SpringBoot2 integrated with oauth2 ( token persisted on redis ), swagger2, restful API, h2db, wechat miniapp, 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
see
http://localhost:8000/h2
active when spring.profiles.active=dev
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=admin"
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
baseURL
https://www.*.com
body
client_id=client&client_secret=security&grant_type=password&auth_type=wx_app&username=%3F&password=$code
method
POST
head Content-Type
application/x-www-form-urlencoded
url
/oauth/token
https://github.com/ustcwudi/springboot-service
https://github.com/ustcwudi/vue-seed