alibaba/aliyun-spring-boot

[Question] throw a error

Open

#51 创建于 2021年1月8日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)Java (110 fork)github user discovery
help wanted

仓库指标

Star
 (461 star)
PR 合并指标
 (PR 指标待抓取)

描述

image Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aliCloudEdasSdk' defined in class path resource [com/alibaba/cloud/spring/boot/context/autoconfigure/EdasContextAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.cloud.context.edas.AliCloudEdasSdk]: Factory method 'aliCloudEdasSdk' threw exception; nested exception is java.lang.NoSuchMethodError: com.aliyuncs.profile.DefaultProfile.getHttpClientConfig()Lcom/aliyuncs/http/HttpClientConfig;

my code:

@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = {ThirdPartyApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) public class ThirdPartyApplicationTests {

@Autowired
private OSS ossClient;


@Test
public void  testUpdload(){

    String bucketName = "yangxiaohui";

    String objectName = "product/b.json";

    String content = "{name:yangxiaohui}";
    ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(content.getBytes()));
    ossClient.shutdown();
}

}

贡献者指南