使用springboot + jpa 连接sqlserver时报的错PKIX path building failed

问题遇到的现象和发生背景

我在使用springboot + jpa 连接sqlserver时报的错PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException ,在这里找到了答案
https://techcommunity.microsoft.com/t5/azure-database-support-blog/pkix-path-building-failed-unable-to-find-valid-certification/ba-p/2591304

问题相关代码,请勿粘贴截图
运行结果及报错内容

SQLServerException: Failed to authenticate the user in Active Directory (Authentication=ActiveDirectoryPassword).
Caused by: ExecutionException: mssql_shaded.com.microsoft.aad.adal4j.AuthenticationException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: AuthenticationException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.

我的解答思路和尝试过的方法

这是Java证书存储中的一个问题。作为一种快速解决方法,如果在连接字符串中启用TrustServerCertificate=True,则来自JDBC的连接成功。当TrustServerCertificate设置为true时,传输层将使用SSL加密通道,并绕过证书链以验证信任。如果TrustServerCertificate设置为true,并且启用了加密,则即使Encrypt设置为false,也将使用服务器上指定的加密级别。否则连接将失败。

spring.datasource.url=jdbc:sqlserver://127.0.0.1:1234;DatabaseName=dsad;trustServerCertificate=true

我想要达到的结果