title: Installation keywords:
This document explains how to install apisix-java-plugin-runner.
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>
```java @SpringBootApplication(scanBasePackages = {"your-filter's-package-name","org.apache.apisix.plugin.runner"})
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>
socket.file = /tmp/runner.sock
PluginFilter
interfaceWhen 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.
A Demo Project that work with apisix-java-plugin-runner and custom filters can be found at: java-plugin-runner-demo.