目录
三个生产者 一个消费者,三个生产者需要用mysql+mybatis 三个不同的数据库。
页面输入用户名和密码,提交到后端消费者,消费者传到生产者后端在进行判断,返回登录成功或登录失败到消费者,消费者再放到页面上进行显示。
1.restTemplate方式
restTemplate.getForObject 向远程取数据 两个参数url和数据类型
restTemplate.postForObject 向远程服务传参数 三个参数url、参数、返回值类型
@RequestBody 跨域(端口不同)得到对象数据,必须是post提交
1.1页面
1.2消费者
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>登录页面</title>
</head>
<body>
<form th:action="@{/loginEntity}" method="post">
<span th:text="${result}"></span>
<input type="username" th:placeholder