Java源码示例:org.springframework.cloud.aws.core.io.s3.PathMatchingSimpleStorageResourcePatternResolver
示例1
public static ResourceLoader createResourceLoader() {
ClientConfiguration configuration = new ClientConfiguration();
configuration.setMaxConnections(1000);
AmazonS3 amazonS3 = new AmazonS3Client(configuration);
SimpleStorageProtocolResolver protocolResolver = new SimpleStorageProtocolResolver(amazonS3);
protocolResolver.afterPropertiesSet();
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
resourceLoader.addProtocolResolver(protocolResolver);
ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(resourceLoader);
return new PathMatchingSimpleStorageResourcePatternResolver(amazonS3, resourceResolver);
}
示例2
@Autowired
public void setupResolver(ApplicationContext applicationContext, AmazonS3 amazonS3) {
this.resourceLoader = new PathMatchingSimpleStorageResourcePatternResolver(
amazonS3, applicationContext);
}
示例3
@Autowired
public void setupResolver(ApplicationContext applicationContext, AmazonS3 amazonS3) {
this.resourcePatternResolver = new PathMatchingSimpleStorageResourcePatternResolver(amazonS3, applicationContext);
}