Skip to content

Commit 29218a6

Browse files
Servicelocator tpl refactoring (#18)
* Added SpiServiceLocators to support multiple SpiServiceLocator annotations on package-info.java * Added SpiServiceLocators to support multiple SpiServiceLocator annotations on package-info.java * Test for multiple SpiServiceLocators * ServiceLocator templated refactored for JDK8 * Added prerequisites to README.md * bump jdk to version 8 Co-authored-by: Tobias Stamann <[email protected]>
1 parent ea9ad0d commit 29218a6

File tree

3 files changed

+388
-252
lines changed

3 files changed

+388
-252
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
# Why you should use this project?
88

99
If you want to use a service provider interface (_SPI_) you need to register your service implementation in the _/META-INF/services/&lt;Full qualified spi interface name&gt;_ file.
10-
Additionally you usually need to write a service locator to be able to use the service implementation.
10+
Additionally, you usually need to write a service locator to be able to use the service implementation.
1111

1212
The annotation processor offered by this project provides exactly this. It allows you to create the service locator file just by adding an annotation to you spi implementation.
13-
Additionally it will generate a service locator for you.
13+
Additionally, it will generate a service locator for you.
14+
15+
# Prerequisites
16+
- The generated ServiceLocator code requires at least JDK 8.
1417

1518
# Features
1619
Annotation processor that
@@ -76,12 +79,13 @@ To create multiple service locators in the same package use @SpiServiceLocators:
7679

7780
@SpiServiceLocators({
7881
@SpiServiceLocator(FirstExampleSpiInterface.class),
79-
@SpiServiceLocator(SecondExampleSpiInterface.class),
82+
@SpiServiceLocator(SecondExampleSpiInterface.class)
8083
})
8184
package your.target.package;
8285

8386
import io.toolisticon.spiap.api.SpiServiceLocator;
84-
import your.spi.package.ExampleSpiInterface;
87+
import your.spi.package.FirstExampleSpiInterface;
88+
import your.spi.package.SecondExampleSpiInterface;
8589

8690
## How to register a service implementation
8791
Just add a Service annotation to your service implementation:
@@ -97,7 +101,7 @@ Just add a Service annotation to your service implementation:
97101
Service annotations mandatory value must declare the SPI you want the service class to be registered to.
98102
All other annotation attributes are optional.
99103

100-
- id defines a custom id which can be used to locate a specific servics implementation via the generated service locator class. Defaults to fully qualified service class name in generated service locator.
104+
- id defines a custom id which can be used to locate a specific services implementation via the generated service locator class. Defaults to fully qualified service class name in generated service locator.
101105
- description declares a short description about the implementation
102106
- priority is used to define a specific order in which the services are located
103107

pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,9 @@
7777
<encoding>UTF-8</encoding>
7878

7979
<java.version>1.8</java.version>
80-
8180
<java.compile.source.version>${java.version}</java.compile.source.version>
8281
<java.compile.target.version>${java.version}</java.compile.target.version>
8382

84-
8583
<cute.version>0.12.0</cute.version>
8684
<aptk.version>0.20.0</aptk.version>
8785

0 commit comments

Comments
 (0)