Installation
Overview#
This document explains how to install apisix-java-plugin-runner.
Prerequisites#
- JDK 11
- APISIX master branch
- Refer to Debug to build the debug environment.
Install#
- Create a simple web application with Spring Boot, and choose Maven as the build tool. 
- Add the apisix-java-plugin-runner dependency in your POM, like: 
<dependency>
    <groupId>org.apache.apisix</groupId> 
    <artifactId>apisix-runner-starter</artifactId>
    <version>0.4.0</version>
</dependency>
- Configuring the scan package path
```java
@SpringBootApplication(scanBasePackages = {"your-filter's-package-name","org.apache.apisix.plugin.runner"})
- Excluding the default logging framework
To prevent multiple slf4j bindings, exclude the logback-classic and log4j-to-slf4j in pom.xml, like:
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
           <exclusion>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
           </exclusion>
           <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-to-slf4j</artifactId>
           </exclusion>
    </exclusions>
</dependency>
- Configuring the address for Unix Domain Socket communication with APISIX
socket.file = /tmp/runner.sock
- Implementing the PluginFilterinterface
When you write your custom plugins, you need to implement the PluginFilter interface and
inject filters into Spring Boot's object lifecycle management using @Component.
code example:
@Component
public class RewriteRequestDemoFilter implements PluginFilter {
  ......
  implementing functions
}
You can refer to development to learn how to write custom plugins.
Demo#
A Demo Project that work with apisix-java-plugin-runner and custom filters can be found at: java-plugin-runner-demo.