Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper annotation for injecting cache with CDI? #397

Open
Quix0r opened this issue Dec 20, 2017 · 2 comments
Open

Proper annotation for injecting cache with CDI? #397

Quix0r opened this issue Dec 20, 2017 · 2 comments

Comments

@Quix0r
Copy link

Quix0r commented Dec 20, 2017

Hi,

I currently use fish.payara.cdi.jsr107.impl.NamedCache for naming my CDI-injected cache. Excerpt from my code (which will be GNU AGPLv3 but that is not relevant here):

	/**
	 * Cached products
	 */
	@Inject
	@NamedCache (cacheName = "productCache")
	private Cache<Long, Product> productCache;

By Product is a POJI for an entity and Long is the entity's persisted primary key (aka. "insert-id").

This currently works flawless, except that I have a warning in my IDE: "Unsatisfied dependency: no bean matches the injection point". this.productCache is immediately available, even in a @PostConstruct annotated method.

As I said, it works (not flawless due to the warning) but it feels not right as it makes my project depending on a specific release of Payara (they are around here, too) as the needed payara-api.jar seem to be updated (e.g. it just happened from 173 to 174 build) sometimes and then I need to update it in my project, too. Plus I need to ask my users to have that specific build.

I would love to see this annotation being fixed (by Payara, of course) and then included into JS107 specs.

@cruftex
Copy link
Member

cruftex commented Aug 6, 2019

Injecting in containers was discussed here:
#208

@Quix0r
Copy link
Author

Quix0r commented Oct 4, 2019

So how is it done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants