You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "zhfeng (via GitHub)" <gi...@apache.org> on 2025/04/14 07:15:48 UTC
[PR] Fix #7254 to support named entityManagerFactory in camel-quarkus-jpa [camel-quarkus]
zhfeng opened a new pull request, #7261:
URL: https://github.com/apache/camel-quarkus/pull/7261
<!-- Uncomment and fill this section if your PR is not trivial
[ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
[ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
[ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
[ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
[ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
[ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #7254 to support named entityManagerFactory in camel-quarkus-jpa [camel-quarkus]
Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on code in PR #7261:
URL: https://github.com/apache/camel-quarkus/pull/7261#discussion_r2041598658
##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/NamedAnnotationLiteral.java:
##########
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+
+/**
+ * An interface for annotation literals that are named
+ */
+public interface NamedAnnotationLiteral {
+ AnnotationLiteral getLiteral(String name);
Review Comment:
Some kinds of beans might require that we select them through multiple qualifiers, no? To solve that possible future use case, this method should rather return an array of `AnnotationLiteral`. But because, I guess, there is no such case in sight, it is fine to keep the current solution as is and change it only once we hit such a case. I hope everybody agrees?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #7254 to support named entityManagerFactory in camel-quarkus-jpa [camel-quarkus]
Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga merged PR #7261:
URL: https://github.com/apache/camel-quarkus/pull/7261
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #7254 to support named entityManagerFactory in camel-quarkus-jpa [camel-quarkus]
Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #7261:
URL: https://github.com/apache/camel-quarkus/pull/7261#discussion_r2043433386
##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/RuntimeBeanRepository.java:
##########
@@ -80,6 +81,17 @@ private static <T> Set<T> getReferencesByType(BeanManager manager, Class<T> type
private static <T> Optional<T> getReferenceByName(BeanManager manager, String name, Class<T> type) {
Set<Bean<?>> beans = manager.getBeans(name);
+ // If it is a Synthetic bean, it should match with type
+ beans = beans.stream()
+ .filter(bean -> {
+ if (bean instanceof InjectableBean injectableBean) {
+ return !injectableBean.getKind().equals(InjectableBean.Kind.SYNTHETIC)
+ || bean.getTypes().contains(type);
+ } else {
+ return true;
+ }
+ }).collect(Collectors.toSet());
+
Review Comment:
@jamesnetherton @ppalaga I replace to check the beans which are generated by the extensions are `SYNTHETIC`. We don't need to introduce a `NamedAnnotationLiteral` build item. The `EntityManagerFactory` class from `quarkus-hibernete-orm` is also with `@Named` annotation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org