现有代码:
public class AWSConfiguration
{
@Autowired
PropertyConfig property;
public AmazonSQS getSqs()
{
return AmazonSQSClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(getBasicAWSCredentials()))
.withRegion(Regions.US_WEST_2)
.build();
}
}
我想让从属性文件配置的区域说:在 application.properties 文件中
awsRegion=us-west-2
并在现有代码中使用此属性
public AmazonSQS getSqs()
{
return AmazonSQSClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(getBasicAWSCredentials()))
.withRegion({fetch from property file})
.build();
}