需要在配置文件中:加入

server:
  ssl:
    key-store: classpath:https.keystore
    key-store-type: JKS
    key-alias: tomcat
    key-password: 123456
    key-store-password: 123456
  port: 8089

这样原本请求的http,就需要变成https,其他类似

@RestController
public class HttpsController {
    @Autowired
    JdbcTemplate jdbcTemplate;
 
@PostMapping("/coordinates")
public String coordinates(@RequestBody String aa){
    System.out.println("1.1 的 https请求,入参" + aa.toString());
    return aa.toString();
}
 
}


使用postman


点击send

在服务端打印出请求

boot 创建 https_tomcat

 

@PostMapping("/queryUser")
public String queryUser(@RequestBody String aa){
    Params p = JSONObject.parseObject(aa, Params.class);
    String sql="select * from user";
 
}

boot 创建 https_配置文件_02

有需要或建议可留言