微服务项目谷粒商城项目中遇到的问题
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异步情况丢失上下文问题
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库