jakartaee / jakartaee/platform

Prioritize CDI Name definition and lookup for Managed Resource

Open
#1,054 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
230
Forks
77
Avg merge
8d 5h
Merged PRs (30d)
1

Description

Currently, `@DataSourceDefinition` in common annotations, `@ManagedExecutorDefinition/@ManagedScheduledExecutorDefinition/@ManagedThreadFacotryDefinition/@ContextServiceDefinition` in concurrency, `@JMSConnectionFactoryDefinition/@JMSDestinationDefinition`in messaging, `@BasicAuthenticationMechanismDefinition/@FormAuthenticationMechanismDefinition/@CustomFormAuthenrticationMechanismDefinition/@OpenIdAuthenticationMechanismDefinition` in security, all provides a `name` but it is the JNDI name.

Unfortunately, the support of JNDI naming and lookup in the implementors, eg, Glassfish, OpenLiberty, etc are very different.

Also consider a definition annotation for Persistence unit to apply this pattern, see https://github.com/jakartaee/persistence/issues/701

**Describe the solution you'd like**
As a developer, I hope these definitions accept a CDI valid name as the `name` attribute here, and prefer to use CDI name and CDI container to lookup the resources.

For example:

```java
@DataSourceDefinition(name="bootstoreDs"....)
class DataSourceConfig{}

@ApplicationScoped
class BookRepository{

@Inject @Named("bookstoreDs")
DataSource bookstoreDs;
}
```

Currently, not all of these annotations add `qualifiers` to identify the resources as CDI beans(hope all specifications are aligned with this change).

But convert it to CDI beans by name is more common and acceptable.

Contributor guide

Open the contributing guide

Research direction

Review the listed Jakarta EE definition annotations and the linked Jakarta Persistence issue #701 first. Clarify the proposed CDI-name and CDI-container lookup behavior across the affected specifications, including how resources become CDI beans and what aligned annotation changes would be required; done means the scope and specification changes are agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.