Skip to content

Commit

Permalink
Solve issue about named beans
Browse files Browse the repository at this point in the history
(cherry picked from commit 37dc798)
  • Loading branch information
mcruzdev authored and gsmet committed Feb 18, 2025
1 parent cec051a commit d267a96
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ private String getBeanNameFromBeanInstance(AnnotationInstance annotationInstance
}
if (beanName == null || beanName.isEmpty()) {
final AnnotationValue beanValueAnnotationValue = annotationInstance.value();
if (beanNameAnnotationValue != null) {
if (beanValueAnnotationValue != null) {
beanName = determineName(beanValueAnnotationValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.quarkus.it.spring;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfigurationWithNamedBean {

@Bean("mySpecialName")
public String foo() {
return "foo";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.quarkus.it.spring;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class UseNamedBeanService {

String name;

public UseNamedBeanService(@Qualifier("mySpecialName") String name) {
this.name = name;
}

public String getName() {
return name;
}
}

0 comments on commit d267a96

Please sign in to comment.