Skip to content

Commit 307f158

Browse files
committed
Fix eager context
1 parent 580a231 commit 307f158

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/com/coditory/quark/context/Context.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static Context createEager(String name, Set<BeanHolder<?>> beanHolders, Set<Bean
6060
if (descriptor.name() != null) {
6161
context.get(descriptor.type(), descriptor.name());
6262
} else {
63-
context.get(descriptor.type());
63+
context.getAll(descriptor.type());
6464
}
6565
});
6666
log.info("Created eager context in {}", totalTimer.measureAndFormat());
@@ -183,7 +183,7 @@ <T> T getOrNull(BeanDescriptor<T> descriptor, ResolutionPath path) {
183183
.toList();
184184
if (holders.size() > 1 && unnamedHolders.size() != 1) {
185185
throw new ContextException("Expected single bean: " + descriptor.toShortString()
186-
+ ". Got: " + holders.size());
186+
+ ". Found " + holders.size() + " beans.");
187187
}
188188
BeanHolder<?> holder = unnamedHolders.size() == 1
189189
? unnamedHolders.get(0)

src/test/groovy/com/coditory/quark/context/BeanResolutionSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BeanResolutionSpec extends Specification {
4949
context.getOrNull(Bar)
5050
then:
5151
ContextException e = thrown(ContextException)
52-
e.message == "Expected single bean: Bar. Got: 2"
52+
e.message == "Expected single bean: Bar. Found 2 beans."
5353
}
5454

5555
def "should fail to retrieve bean by type when multiple unnamed beans are registered"() {
@@ -62,7 +62,7 @@ class BeanResolutionSpec extends Specification {
6262
context.getOrNull(Bar)
6363
then:
6464
ContextException e = thrown(ContextException)
65-
e.message == "Expected single bean: Bar. Got: 2"
65+
e.message == "Expected single bean: Bar. Found 2 beans."
6666
}
6767

6868
def "should retrieve named bean by type and name"() {

0 commit comments

Comments
 (0)