Skip to content

Commit

Permalink
use spi-service's annotations for spi
Browse files Browse the repository at this point in the history
  • Loading branch information
SentryMan committed Jun 25, 2024
1 parent 103728a commit 1d398a7
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 18 deletions.
6 changes: 6 additions & 0 deletions blackbox-test-inject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
<artifactId>avaje-inject</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-spi-service</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>io.github.resilience4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import io.avaje.config.Config;
import io.avaje.inject.Component;
import io.avaje.inject.spi.ConfigPropertyPlugin;
import io.avaje.inject.spi.InjectSpi;
import io.avaje.spi.ServiceProvider;

import org.other.one.OtherComponent2;

import java.util.Optional;

@InjectSpi
@ServiceProvider
@Component.Import(value = OtherComponent2.class)
public class ConfigPropertiesPlugin implements ConfigPropertyPlugin {

Expand Down
7 changes: 6 additions & 1 deletion inject-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
<optional>true</optional>
<scope>provided</scope>
</dependency>


<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-spi-service</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>io.avaje</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
FactoryPrism.PRISM_TYPE,
ImportPrism.PRISM_TYPE,
InjectModulePrism.PRISM_TYPE,
InjectSpiPrism.PRISM_TYPE,
PrototypePrism.PRISM_TYPE,
QualifierPrism.PRISM_TYPE,
ScopePrism.PRISM_TYPE,
SingletonPrism.PRISM_TYPE,
"io.avaje.spi.ServiceProvider"
})
public final class InjectProcessor extends AbstractProcessor {

Expand Down Expand Up @@ -154,7 +154,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
.map(UType::fullWithoutAnnotations)
.forEach(ProcessingContext::addOptionalType);

maybeElements(roundEnv, InjectSpiPrism.PRISM_TYPE).ifPresent(this::registerSPI);
maybeElements(roundEnv, "io.avaje.spi.ServiceProvider").ifPresent(this::registerSPI);
allScopes.readBeans(roundEnv);
defaultScope.write(processingOver);
allScopes.write(processingOver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
@GeneratePrism(Factory.class)
@GeneratePrism(Generated.class)
@GeneratePrism(Inject.class)
@GeneratePrism(InjectSpi.class)
@GeneratePrism(InjectModule.class)
@GeneratePrism(Lazy.class)
@GeneratePrism(Named.class)
Expand Down
7 changes: 7 additions & 0 deletions inject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-spi-service</artifactId>
<version>1.11</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
3 changes: 3 additions & 0 deletions inject/src/main/java/io/avaje/inject/spi/InjectExtension.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package io.avaje.inject.spi;

import io.avaje.spi.Service;

/** Superclass for all Inject SPI classes */
@Service
public interface InjectExtension {}
12 changes: 0 additions & 12 deletions inject/src/main/java/io/avaje/inject/spi/InjectSpi.java

This file was deleted.

1 change: 1 addition & 0 deletions inject/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
requires transitive jakarta.inject;
requires static io.avaje.config;
requires static org.mockito;
requires static io.avaje.spi;

uses io.avaje.inject.spi.InjectExtension;
uses io.avaje.inject.spi.Module;
Expand Down

0 comments on commit 1d398a7

Please sign in to comment.