auto-service

Auto generate `META-INF/services` file.

License

License

Categories

Categories

Auto Application Layer Libs Code Generators
GroupId

GroupId

org.ifinal.auto
ArtifactId

ArtifactId

auto-service
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

auto-service
Auto generate `META-INF/services` file.

Download auto-service

How to add to project

<!-- https://jarcasting.com/artifacts/org.ifinal.auto/auto-service/ -->
<dependency>
    <groupId>org.ifinal.auto</groupId>
    <artifactId>auto-service</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.ifinal.auto/auto-service/
implementation 'org.ifinal.auto:auto-service:1.0.0'
// https://jarcasting.com/artifacts/org.ifinal.auto/auto-service/
implementation ("org.ifinal.auto:auto-service:1.0.0")
'org.ifinal.auto:auto-service:jar:1.0.0'
<dependency org="org.ifinal.auto" name="auto-service" rev="1.0.0">
  <artifact name="auto-service" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.ifinal.auto', module='auto-service', version='1.0.0')
)
libraryDependencies += "org.ifinal.auto" % "auto-service" % "1.0.0"
[org.ifinal.auto/auto-service "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Auto Service

Auto Service

GitHub Workflow Status Maven Central Sonatype Nexus (Releases) Sonatype Nexus (Snapshots)

Auto Service 实现自动生成META-INF/services文件的功能,减少配置文件的编写,除了支持 JAVA 标准的 SPI,也支持类似于 Dubbo 扩展 SPI 方式。

Usage

Import Dependency

<dependency>
    <groupId>org.ifinal.auto</groupId>
    <artifactId>auto-service</artifactId>
    <version>${latest.version}</version>
</dependency>

Java SPI

package org.ifinal.auto.service;

@AutoProcessor
@SupportedOptions({"debug", "verify"})
@SupportedSourceVersion(SourceVersion.RELEASE_8)
@SupportedAnnotationTypes("*")
public class MyProcessor extends AbstractProcessor {

    @Override
    public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
        return false;
    }

}

编译后在会生成配置文件META-INF/serivces/javax.annotation.processing.Processor

org.ifinal.auto.service.MyProcessor

Dubbo SPI

package org.ifinal.auto.service;

@AutoService(value = Filter.class, path = "dubbo", name = "myFilter")
public class MyFilter implements Filter {

    @Override
    public Result invoke(final Invoker<?> invoker, final Invocation invocation) throws RpcException {
        return null;
    }

}

编译后在会生成配置文件META-INF/dubbo/org.apache.dubbo.rpc.Filter,内容如下:

myFilter=org.ifinal.auto.service.MyFilter
org.ifinal.auto

Final

简单、易用的开发脚手架

Versions

Version
1.0.0