このコンテンツは選択した言語では利用できません。
15.2.2.2. Override the Creation of the Embedded Cache Manager
Prerequisites
Creating Non Clustered Caches
After a producer method is annotated, this method will be called when creating an EmbeddedCacheManager, as follows:
The
@ApplicationScoped annotation specifies that the method is only called once.
Creating Clustered Caches
The following configuration can be used to create an EmbeddedCacheManager that can create clustered caches.
Invoke the Method to Generate an EmbeddedCacheManager
The method annotated with @Produces in the non clustered method generates Configuration objects. The methods in the clustered cache example annonated with @Produces generate EmbeddedCacheManager objects.
Add an injection as follows in your CDI Bean to invoke the appropriate annotated method. This generates
EmbeddedCacheManager and injects it into the code at runtime.
... @Inject EmbeddedCacheManager cacheManager; ...
...
@Inject
EmbeddedCacheManager cacheManager;
...