Coder Social home page Coder Social logo

springcloud-demo's Introduction

springcloud-demo

当前开发(运行)环境:

  • win10
  • maven3.6.3
  • OpenJDK17
  • Docker
  • IDEA

项目安装

  1. 使用Git拉取项目
git clone https://gitee.com/mkingdragon/springcloud-demo.git

​ 默认使用Gitee,也可以使用Github

git clone https://github.com/MW-S/springcloud-demo.git
  1. 在项目根目录下运行下列命令
mvn clean install

项目运行

LDAP服务相关

  1. 服务启动后,LDAP服务器的数据需要手动导入一下,文件目录在all/openldap/ldap_admin.ldif
  2. LDAP管理员
    1. 账号:cn=admin,dc=test,dc=com
    2. 密码:123456

Mysql服务相关

  1. 账号:root
  2. 密码:123456

系统账号密码

image-20240324011915688

项目启动

  1. 若只想运行Mysql以及LDAP服务,则直接到OtherService目录,运行以下指令

    docker-compose up -d
  2. 在根目录下进行打包,jar包会自动存放至all文件夹

mvn clean package
  1. 打包完成后,需要到各个项目的根目录下面的target目录将jar包放置到all目录下,并分别重命名为Config.jar、Eureka.jar、Provider.jar、Uaa.jar

    image-20240324004246011

  2. 进入all目录,使用docker-compose一键运行容器(运行完成后,LDAP服务器的数据需要手动导入一下,文件目录在all/openldap/ldap_admin.ldif)

docker-compose up -d

运行效果:

注:windows下的参数双引号需要加转义符

获取token(数据库):

Linux环境:
curl.exe -X POST  -H "Content-Type: application/json"    -d '{"username":"editor_1","password":"editor_1"}'    "http://127.0.0.1:7573/jwt/login"
Windows CMD:
curl.exe -X POST  -H "Content-Type: application/json"    -d "{\"username\":\"editor_1\",\"password\":\"editor_1\"}"    "http://127.0.0.1:7573/jwt/login"
效果图

image-20240323234312873

获取token(LDAP):

Linux环境:
curl.exe -X POST  -H "Content-Type: application/json"    -d '{"username":"ldap_user_1","password":"ldap_user_1"}'    "http://127.0.0.1:7573/ldap/login"
Windows CMD:
curl.exe -X POST  -H "Content-Type: application/json"    -d "{\"username\":\"ldap_user_1\",\"password\":\"ldap_user_1\"}"    "http://127.0.0.1:7573/ldap/login"
效果图

image-20240324002307881

添加产品

Linux环境:
curl.exe -X POST  -H "Content-Type: application/json" -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"   -d '{"name":"product1"}'    "http://127.0.0.1:7573/product/save"
Windows CMD:
curl.exe -X POST  -H "Content-Type: application/json" -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"   -d "{\"name\":\"product1\"}"   "http://127.0.0.1:7573/product/save"
image-20240324000936171

查询产品列表

Linux环境:
curl.exe -X GET   -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"    "http://127.0.0.1:7573/product/getList"
Windows CMD:
curl.exe -X GET   -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"    "http://127.0.0.1:7573/product/getList"
image-20240324001701733

修改产品

Linux环境:
curl.exe -X POST  -H "Content-Type: application/json" -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"   -d '{"id":"2","name":"u_product1"}'    "http://127.0.0.1:7573/product/update"
Windows CMD:
curl.exe -X POST  -H "Content-Type: application/json" -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"   -d "{\"id\":\"2\", \"name\":\"u_product1\"}"   "http://127.0.0.1:7573/product/update"
image-20240324001924701

删除产品

Linux环境:
curl.exe -X POST  -H "Content-Type: application/json" -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"   -d '{"id":"2"}'    "http://127.0.0.1:7573/product/delById"
Windows CMD:
curl.exe -X POST  -H "Content-Type: application/json" -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MTEyMTExNzIsInN1YiI6ImVkaXRvcl8xIn0.S6qYlPI9Rhy9ZQIxfabSRD7hWlYJExF4SjrZcZtazWI"   -d "{\"id\":\"2\"}"   "http://127.0.0.1:7573/product/delById"
image-20240324002042588

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.