List of usage examples for org.springframework.web.context WebApplicationContext SCOPE_APPLICATION
String SCOPE_APPLICATION
To view the source code for org.springframework.web.context WebApplicationContext SCOPE_APPLICATION.
Click Source Link
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public MemcachedClient memcachedClient(final ConfigurationSettings settings) throws IOException { MemcachedClient client = null;// w w w.j a va2 s . com if (settings.getProperty(ConfigurationSettings.ConfigProps.CACHE_ENABLED).equalsIgnoreCase("true")) { String configEndpoint = settings.getProperty(ConfigurationSettings.ConfigProps.CACHE_ENDPOINT); Integer clusterPort = Integer .parseInt(settings.getProperty(ConfigurationSettings.ConfigProps.CACHE_PORT)); client = new MemcachedClient(new InetSocketAddress(configEndpoint, clusterPort)); } return client; }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AWSCredentialsProvider credentials() { return new AWSCredentialsProviderChain(new InstanceProfileCredentialsProvider(), new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider()); }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public Region region(final ConfigurationSettings settings) { return Region .getRegion(Regions.fromName(settings.getProperty(ConfigurationSettings.ConfigProps.AWS_REGION))); }
From source file:net.wessendorf.spring.scopes.CdiScopeMetadataResolver.java
/** * Checks if one of the following CDI scope annoations are used and maps * them to their matching Spring scopes: * //from w ww . ja v a2 s . c o m * <ul> * <li><code>@javax.enterprise.context.RequestScoped</code></li> * <li><code>@javax.enterprise.context.SessionScoped</code></li> * <li><code>@javax.enterprise.context.ApplicationScoped</code></li> * </ul> * * If none of them are found it delegates back to the original Spring * <code>AnnotationScopeMetadataResolver</code> class. */ @Override public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) { ScopeMetadata metadata = new ScopeMetadata(); if (definition instanceof AnnotatedBeanDefinition) { AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition; Set<String> annotationTypes = annDef.getMetadata().getAnnotationTypes(); if (annotationTypes.contains(RequestScoped.class.getName())) { metadata.setScopeName(WebApplicationContext.SCOPE_REQUEST); } else if (annotationTypes.contains(SessionScoped.class.getName())) { metadata.setScopeName(WebApplicationContext.SCOPE_SESSION); } else if (annotationTypes.contains(ApplicationScoped.class.getName())) { metadata.setScopeName(WebApplicationContext.SCOPE_APPLICATION); } else { // do the regular Spring stuff.. return super.resolveScopeMetadata(definition); } } return metadata; }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonElasticTranscoder transcodeClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonElasticTranscoderClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonS3 s3Client(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonS3Client.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonRDS rdsClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonRDSClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonDynamoDB dynamoClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonDynamoDBClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonCloudWatchAsyncClient cloudwatchClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonCloudWatchAsyncClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonSQS sqsClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonSQSClient.class, creds, null); }