***************************
APPLICATION FAILED TO START
***************************
Description:
Field ossClient in com.atguigu.gulimall.gulimall.thirdparty.controller.OSSController required a bean of type 'com.aliyun.oss.OSSClient' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.aliyun.oss.OSSClient' in your configuration.
Process finished with exit code 1
注入OSSClient实例失败
添加配置类
@Configuration
public class OSSConfig {
@Value("${spring.cloud.alicloud.oss.endpoint}")
private String endpoint;
@Value("${spring.cloud.alicloud.access-key}")
String accessId;
@Value("${spring.cloud.alicloud.secret-key}")
String accessKey;
@Bean
public OSSClient ossClient() {
return new OSSClient(endpoint, accessKey, accessKey);
}
}