Annotation Interface EnableRedisRepositories
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Inherited
@Import(RedisRepositoriesRegistrar.class)
@QueryCreatorType(RedisQueryCreator.class)
public @interface EnableRedisRepositories
Annotation to activate Redis repositories. If no base package is configured through either
value()
,
basePackages()
or basePackageClasses()
it will trigger scanning of the package of annotated class.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionClass<?>[]
Type-safe alternative tobasePackages()
for specifying the packages to scan for annotated components.String[]
Base packages to scan for annotated components.boolean
Configures whether nested repository-interfaces (e.g. defined as inner classes) should be discovered by the repositories infrastructure.Configure usage ofKeyExpirationEventMessageListener
.org.springframework.context.annotation.ComponentScan.Filter[]
Specifies which types are not eligible for component scanning.org.springframework.context.annotation.ComponentScan.Filter[]
Specifies which types are eligible for component scanning.Class<? extends IndexConfiguration>
Set up index patterns using simple configuration class.Class<? extends KeyspaceConfiguration>
Set up keyspaces for specific types.Configure the notify-keyspace-events property if not already set.Configures the name of theKeyValueOperations
bean to be used with the repositories detected.Configure the name of theRedisMessageListenerContainer
bean to be used for keyspace event subscriptions.Configures the location of where to find the Spring Data named queries properties file.org.springframework.data.repository.query.QueryLookupStrategy.Key
Returns the key of theQueryLookupStrategy
to be used for lookup queries for query methods.Configures the bean name of theRedisOperations
to be used.Class<?>
Configure the repository base class to be used to create repository proxies for this particular configuration.Class<?>
Returns theFactoryBean
class to be used for each repository instance.Returns the postfix to be used when looking up custom repository implementations.Configuration flag controlling storage of phantom keys (shadow copies) of expiring entities to read them later when publishingkeyspace events
.String[]
Alias for thebasePackages()
attribute.
-
Element Details
-
value
String[] valueAlias for thebasePackages()
attribute. Allows for more concise annotation declarations e.g.:@EnableRedisRepositories("org.my.pkg")
instead of@EnableRedisRepositories(basePackages="org.my.pkg")
.- Default:
- {}
-
basePackages
String[] basePackagesBase packages to scan for annotated components.value()
is an alias for (and mutually exclusive with) this attribute. UsebasePackageClasses()
for a type-safe alternative to String-based package names.- Default:
- {}
-
basePackageClasses
Class<?>[] basePackageClassesType-safe alternative tobasePackages()
for specifying the packages to scan for annotated components. The package of each class specified will be scanned. Consider creating a special no-op marker class or interface in each package that serves no purpose other than being referenced by this attribute.- Default:
- {}
-
excludeFilters
org.springframework.context.annotation.ComponentScan.Filter[] excludeFiltersSpecifies which types are not eligible for component scanning.- Default:
- {}
-
includeFilters
org.springframework.context.annotation.ComponentScan.Filter[] includeFiltersSpecifies which types are eligible for component scanning. Further narrows the set of candidate components from everything inbasePackages()
to everything in the base packages that matches the given filter or filters.- Default:
- {}
-
repositoryImplementationPostfix
String repositoryImplementationPostfixReturns the postfix to be used when looking up custom repository implementations. Defaults to Impl. So for a repository namedPersonRepository
the corresponding implementation class will be looked up scanning forPersonRepositoryImpl
.- Returns:
- Default:
- "Impl"
-
namedQueriesLocation
String namedQueriesLocationConfigures the location of where to find the Spring Data named queries properties file.- Returns:
- Default:
- ""
-
queryLookupStrategy
org.springframework.data.repository.query.QueryLookupStrategy.Key queryLookupStrategyReturns the key of theQueryLookupStrategy
to be used for lookup queries for query methods. Defaults toQueryLookupStrategy.Key.CREATE_IF_NOT_FOUND
.- Returns:
- Default:
- CREATE_IF_NOT_FOUND
-
repositoryFactoryBeanClass
Class<?> repositoryFactoryBeanClassReturns theFactoryBean
class to be used for each repository instance. Defaults toRedisRepositoryFactoryBean
.- Returns:
- Default:
- org.springframework.data.redis.repository.support.RedisRepositoryFactoryBean.class
-
repositoryBaseClass
Class<?> repositoryBaseClassConfigure the repository base class to be used to create repository proxies for this particular configuration.- Returns:
- Default:
- org.springframework.data.repository.config.DefaultRepositoryBaseClass.class
-
keyValueTemplateRef
String keyValueTemplateRefConfigures the name of theKeyValueOperations
bean to be used with the repositories detected.- Returns:
- Default:
- "redisKeyValueTemplate"
-
considerNestedRepositories
boolean considerNestedRepositoriesConfigures whether nested repository-interfaces (e.g. defined as inner classes) should be discovered by the repositories infrastructure.- Default:
- false
-
redisTemplateRef
String redisTemplateRefConfigures the bean name of theRedisOperations
to be used. Defaulted to redisTemplate.- Returns:
- Default:
- "redisTemplate"
-
indexConfiguration
Class<? extends IndexConfiguration> indexConfigurationSet up index patterns using simple configuration class.- Returns:
- Default:
- org.springframework.data.redis.core.index.IndexConfiguration.class
-
keyspaceConfiguration
Class<? extends KeyspaceConfiguration> keyspaceConfigurationSet up keyspaces for specific types.- Returns:
- Default:
- org.springframework.data.redis.core.convert.KeyspaceConfiguration.class
-
enableKeyspaceEvents
RedisKeyValueAdapter.EnableKeyspaceEvents enableKeyspaceEventsConfigure usage ofKeyExpirationEventMessageListener
.- Returns:
- Since:
- 1.8
- Default:
- OFF
-
messageListenerContainerRef
String messageListenerContainerRefConfigure the name of theRedisMessageListenerContainer
bean to be used for keyspace event subscriptions. Defaults to use an anonymous managed instance byRedisKeyValueAdapter
.- Returns:
- Since:
- 2.7.2
- Default:
- ""
-
shadowCopy
RedisKeyValueAdapter.ShadowCopy shadowCopyConfiguration flag controlling storage of phantom keys (shadow copies) of expiring entities to read them later when publishingkeyspace events
.- Returns:
- Since:
- 2.4
- Default:
- DEFAULT
-
keyspaceNotificationsConfigParameter
String keyspaceNotificationsConfigParameterConfigure the notify-keyspace-events property if not already set.
Use an emptyString
to keep (not alter) existing server configuration.- Returns:
- Ex by default.
- Since:
- 1.8
- Default:
- "Ex"
-