-
Aug 29th, 2012, 01:59 PM
#1
Beans creating and external libraries
Hi,
my Spring application fails trying to initialize bean with @Postconstruct.
The bean depends on external library (SAX parser).
Could that be a problem? How it could be managed?
* Comment for the code below: AmazonS3 uses SAX parser within 'doesBucketExist' method
Code:
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
public class MyClass {
....
@Postconstruct
public void init (String s3key, String s3secret, String s3bucket, String s3region) {
AWSCredentials credentials = new BasicAWSCredentials(String s3key, String s3secret);
AmazonS3 s3 = new AmazonS3Client(credentials);
if (!s3.doesBucketExist(s3bucket)) {
s3.createBucket(s3bucket, s3region);
}
}
....
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules