Skip to content

Commit 47c482a

Browse files
committed
Review fixes.
1 parent 24dd507 commit 47c482a

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

service/inject/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ The generated main class will contain full, reflection less configuration of the
379379

380380
The Main class can also be customized; to do this:
381381
1. Create a custom class (let's call it `CustomMain` as an example)
382-
2. The class must extends the injection main class (`public abstract class CustomMain extends InjectionMain`)
382+
2. The class must extend the injection main class (`public abstract class CustomMain extends InjectionMain`)
383383
3. The class must be annotated with `@Injection.Main`, so it is discovered by annotation processor
384384
4. Implement any desired methods; the generated class will only implement `serviceDescriptors(InjectConfig.Builder configBuilder)` (always), and `discoverServices()` (if created from the Maven plugin)
385385

service/inject/inject/src/main/java/io/helidon/service/inject/InjectStartupProvider.java

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public void start(String[] arguments) {
6060

6161
@Override
6262
protected void serviceDescriptors(InjectConfig.Builder configBuilder) {
63+
// service descriptors are discovered when startup provider is used - see below discoverServices() method
6364
}
6465

6566
@Override

service/inject/maven-plugin/src/main/java/io/helidon/service/inject/maven/plugin/BindingGenerator.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,14 @@ private InjectionPlan injectionPlan(WrappedServices services,
291291
Lookup dependencyTo = Lookup.create(dependency);
292292
Set<Qualifier> qualifiers = dependencyTo.qualifiers();
293293
if (self.contracts().containsAll(dependencyTo.contracts()) && self.qualifiers().equals(qualifiers)) {
294-
// criteria must have a single contract for each injection point
295-
// if this service implements the contracts actually required, we must look for services with lower weight
296-
// but only if we also have the same qualifiers
294+
/*
295+
lookup must have a single contract for each injection point
296+
if this service implements the contracts actually required, we must look for services with lower weight
297+
but only if we also have the same qualifiers;
298+
this is to ensure that if an injection point in a service injects a contract the service implements itself,
299+
we do not end up in an infinite loop, but look for a service with a lower weight to satisfy that injection point
300+
this allows us to "chain" a single contract through multiple services
301+
*/
297302
dependencyTo = Lookup.builder(dependencyTo)
298303
.weight(self.weight())
299304
.build();

0 commit comments

Comments
 (0)