源码下载地址:https://github.com/zhengzizhi/microservice-store-localhost.git

[root@cloud ~]# hostname
cloud.com
[root@cloud ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 cloud.com
[root@cloud ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:92:8e:c5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.200/24 brd 192.168.10.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe92:8ec5/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:06:fd:71 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:06:fd:71 brd ff:ff:ff:ff:ff:ff
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:ea:27:1f:99 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
[root@cloud ~]# 

How to start this project (spring.profiles.active = development)

cd /opt/examples/microservice-store-localhost/discovery-service && mvn clean && mvn spring-boot:run
cd /opt/examples/microservice-store-localhost/auth-service && mvn clean && mvn spring-boot:run
cd /opt/examples/microservice-store-localhost/account-service && mvn clean && mvn spring-boot:run
cd /opt/examples/microservice-store-localhost/inventory-service && mvn clean && mvn spring-boot:run
cd /opt/examples/microservice-store-localhost/catalog-service && mvn clean && mvn spring-boot:run
cd /opt/examples/microservice-store-localhost/gateway-service && mvn clean && mvn spring-boot:run
cd /opt/examples/microservice-store-localhost/online-ui1-service && mvn clean && mvn spring-boot:run
cd /opt/examples/microservice-store-localhost/online-ui2-service && mvn clean && mvn spring-boot:run

http://localhost:8761

http://localhost:9893/v1/catalog
http://localhost:9999/catalog/v1/catalog
http://localhost:8781/api/catalog/v1/catalog
http://localhost:8782/api/catalog/v1/catalog

login user and password (username = jack ,password = pass123)

http://localhost:8781/
http://localhost:8782/

点击 Login 直接进入受保护的页面,也就是不需要再输入密码进入第2个不同域名的子系统

http://localhost:8782/securedPage

http://localhost:8181/uaa/actuator

http://localhost:8181/uaa/actuator/health

[root@cloud ~]# curl -v -X GET \
  http://localhost:8181/uaa/v1/me \
  -H 'authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2' \
  -H 'cache-control: no-cache'

* About to connect() to localhost port 8181 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 8181 (#0)
> GET /uaa/v1/me HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8181
> Accept: */*
> authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2
> cache-control: no-cache
> 
< HTTP/1.1 200 
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Mon, 22 Oct 2018 05:42:48 GMT
< 
* Connection #0 to host localhost left intact
{"createdAt":1540184258,"lastModified":1540184258,"id":1,"username":"jack","firstName":"Jack","lastName":"Chen","email":"jack.chen@example.com"}
[root@cloud ~]# 

 [root@cloud ~]# curl -v -X GET \
  http://localhost:9999/user/uaa/v1/me \
  -H 'authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2' \
  -H 'cache-control: no-cache'

* About to connect() to localhost port 9999 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 9999 (#0)
> GET /user/uaa/v1/me HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:9999
> Accept: */*
> authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2
> cache-control: no-cache
> 
< HTTP/1.1 200 
< Date: Mon, 22 Oct 2018 05:46:02 GMT
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
{"createdAt":1540184258,"lastModified":1540184258,"id":1,"username":"jack","firstName":"Jack","lastName":"Chen","email":"jack.chen@example.com"}
[root@cloud ~]# 

 [root@cloud ~]# curl -v -X GET \
  http://localhost:8781/api/user/uaa/v1/me \
  -H 'authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2' \
  -H 'cache-control: no-cache'

* About to connect() to localhost port 8781 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 8781 (#0)
> GET /api/user/uaa/v1/me HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8781
> Accept: */*
> authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2
> cache-control: no-cache
> 
< HTTP/1.1 200 
< Date: Mon, 22 Oct 2018 05:47:44 GMT
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
{"createdAt":1540184258,"lastModified":1540184258,"id":1,"username":"jack","firstName":"Jack","lastName":"Chen","email":"jack.chen@example.com"}[root@cloud ~]# 

 [root@cloud ~]# curl -v -X GET \
  http://localhost:9891/v1/accounts \
  -H 'authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2' \
  -H 'cache-control: no-cache'

* About to connect() to localhost port 9891 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 9891 (#0)
> GET /v1/accounts HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:9891
> Accept: */*
> authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2
> cache-control: no-cache
> 
< HTTP/1.1 200 
< Set-Cookie: JSESSIONID=B59D450C9A07B9F214012B39E7ACB42F; Path=/; HttpOnly
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Mon, 22 Oct 2018 05:51:55 GMT
< 
* Connection #0 to host localhost left intact
[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"userId":"jack","accountNumber":"12345","defaultAccount":true,"creditCards":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"number":"****-****-****-4567","type":"VISA"}],"addresses":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"street1":"3495 Deer Creek Road","street2":"","state":"CA","city":"Palo Alto","country":"United States","zipCode":94304,"addressType":"SHIPPING"}]}]
[root@cloud ~]# 

 [root@cloud ~]# curl -v -X GET \
  http://localhost:9999/account/v1/accounts \
  -H 'authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2' \
  -H 'cache-control: no-cache'

* About to connect() to localhost port 9999 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 9999 (#0)
> GET /account/v1/accounts HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:9999
> Accept: */*
> authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2
> cache-control: no-cache
> 
< HTTP/1.1 200 
< Date: Mon, 22 Oct 2018 05:53:48 GMT
< Set-Cookie: JSESSIONID=1E8117588F678328F8EB96A4AA2D9AFD; Path=/; HttpOnly
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"userId":"jack","accountNumber":"12345","defaultAccount":true,"creditCards":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"number":"****-****-****-4567","type":"VISA"}],"addresses":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"street1":"3495 Deer Creek Road","street2":"","state":"CA","city":"Palo Alto","country":"United States","zipCode":94304,"addressType":"SHIPPING"}]}]
[root@cloud ~]# 

 [root@cloud ~]# curl -v -X GET \
  http://localhost:8781/api/account/v1/accounts \
  -H 'authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2' \
  -H 'cache-control: no-cache'

* About to connect() to localhost port 8781 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 8781 (#0)
> GET /api/account/v1/accounts HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8781
> Accept: */*
> authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2
> cache-control: no-cache
> 
< HTTP/1.1 200 
< Date: Mon, 22 Oct 2018 05:55:06 GMT
< Set-Cookie: JSESSIONID=974669E6B5B0B6FA26F37B83B66309FE; Path=/; HttpOnly
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"userId":"jack","accountNumber":"12345","defaultAccount":true,"creditCards":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"number":"****-****-****-4567","type":"VISA"}],"addresses":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"street1":"3495 Deer Creek Road","street2":"","state":"CA","city":"Palo Alto","country":"United States","zipCode":94304,"addressType":"SHIPPING"}]}]
[root@cloud ~]# 

 [root@cloud ~]# curl -v -X GET \
  http://localhost:8782/api/account/v1/accounts \
  -H 'authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2' \
  -H 'cache-control: no-cache'

* About to connect() to localhost port 8782 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 8782 (#0)
> GET /api/account/v1/accounts HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8782
> Accept: */*
> authorization: Bearer d9bd6db3-7efd-4200-839b-7fb8a15505f2
> cache-control: no-cache
> 
< HTTP/1.1 200 
< Date: Mon, 22 Oct 2018 05:56:18 GMT
< Set-Cookie: JSESSIONID=F4D056F1754B2F7669ED90D1CC98557A; Path=/; HttpOnly
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"userId":"jack","accountNumber":"12345","defaultAccount":true,"creditCards":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"number":"****-****-****-4567","type":"VISA"}],"addresses":[{"createdAt":1540187490,"lastModified":1540187490,"id":1,"street1":"3495 Deer Creek Road","street2":"","state":"CA","city":"Palo Alto","country":"United States","zipCode":94304,"addressType":"SHIPPING"}]}]
[root@cloud ~]# 

How to install Neo4j(图谱数据库) on Cent OS 7.5  

请看这篇blog  https://blog.csdn.net/zhengzizhi/article/details/81771383

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐