小编1th*_*odo的帖子

JHipster 无法解析占位符

我扩展了我的 JHipster 应用程序并使用以下代码编写了一个服务类:

@Component
@Transactional
public class AmazonClient {

private AmazonS3 s3Client;

@Value("${amazonProperties.endpointUrl}")
private String endpointUrl;

@Value("${amazonProperties.bucketName}")
private String bucketName;

@Value("${amazonProperties.accessKey}")
private String accessKey;

@Value("${amazonProperties.secretKey}")
private String secretKey;

public AmazonClient() {

}

@PostConstruct
private void initializeAmazon() {
    AWSCredentials credentials = new BasicAWSCredentials(this.accessKey, this.secretKey);
    this.s3Client = new AmazonS3Client(credentials);
}
Run Code Online (Sandbox Code Playgroud)

我的 application-dev.yml 包括以下内容:

amazonProperties:
  endpointUrl: https://s3.eu-central-1.amazonaws.com
  accessKey: XYZ
  secretKey: XYZ
  bucketName: XYZ
Run Code Online (Sandbox Code Playgroud)

当我用 mvwn 启动我的应用程序时,一切正常。当我运行我的测试时,我得到以下异常:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'amazonClient': Injection of autowired dependencies failed; nested exception is …
Run Code Online (Sandbox Code Playgroud)

spring jhipster

0
推荐指数
1
解决办法
773
查看次数

标签 统计

jhipster ×1

spring ×1