Fork me on GitHub

微服务项目谷粒商城项目中遇到的问题

1.服务端签名直传并设置上传回调出现的问题:Consider defining a bean of type 'com.aliyun.oss.OSSClient' in your configuration.

 

找到他的自动装配类打开这个OssContextAutoConfiguration类

复制代码
@ConditionalOnMissingBean
@Bean
public OSS ossClient(AliCloudProperties aliCloudProperties, OssProperties ossProperties) {
    if (ossProperties.getAuthorizationMode() == AliCloudAuthorizationMode.AK_SK) {
        Assert.isTrue(!StringUtils.isEmpty(ossProperties.getEndpoint()), "Oss endpoint can't be empty.");
        Assert.isTrue(!StringUtils.isEmpty(aliCloudProperties.getAccessKey()), "${spring.cloud.alicloud.access-key} can't be empty.");
        Assert.isTrue(!StringUtils.isEmpty(aliCloudProperties.getSecretKey()), "${spring.cloud.alicloud.secret-key} can't be empty.");
        return (new OSSClientBuilder()).build(ossProperties.getEndpoint(), aliCloudProperties.getAccessKey(), aliCloudProperties.getSecretKey(), ossProperties.getConfig());
    } else if (ossProperties.getAuthorizationMode() == AliCloudAuthorizationMode.STS) {
        Assert.isTrue(!StringUtils.isEmpty(ossProperties.getEndpoint()), "Oss endpoint can't be empty.");
        Assert.isTrue(!StringUtils.isEmpty(ossProperties.getSts().getAccessKey()), "Access key can't be empty.");
        Assert.isTrue(!StringUtils.isEmpty(ossProperties.getSts().getSecretKey()), "Secret key can't be empty.");
        Assert.isTrue(!StringUtils.isEmpty(ossProperties.getSts().getSecurityToken()), "Security Token can't be empty.");
        return (new OSSClientBuilder()).build(ossProperties.getEndpoint(), ossProperties.getSts().getAccessKey(), ossProperties.getSts().getSecretKey(), ossProperties.getSts().getSecurityToken(), ossProperties.getConfig());
    } else {
        throw new IllegalArgumentException("Unknown auth mode.");
    }
}
复制代码
ossClient方法他的返回值是OSS是一个·接口,而我们在controller注入的是OSSClient

 2.setnx占好了位,业务代码异常或中途宕机,没有执行删除锁逻辑,这就造成了死锁

解决·:设置锁的自动过期,即使没有删除也会自动删除锁

 

3.Feigin远程调用丢失请求头问题

 

 

 4.Fegin异步情况丢失上下文问题

 

 

 

 

 

 

 

 

 

 

 

 

 

          

 

posted @   风をした  阅读(739)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
点击右上角即可分享
微信分享提示