Introduction
spring-boot
is the core module of the spring
project, which includes: configuration management, plugin management, and component management.
All plugins need to implement the Plugin
feature.
How to write your own plugin
Add dependencies
= { = "0.0.9" } # This crate contains the definition of plugin traits
= { = true, = ["derive"] } # Used to parse plugin configuration items
use Deserialize;
use async_trait;
use Configurable;
use ;
;
/// Configuration item prefix
/// Plugin configuration
You can use the derive macro to implement the Configurable trait:
/// Use the `config_prefix` attr macro to define the prefix configured in the toml file
;
For the complete code, refer to plugin-example
, or refer to other built-in plugin codes.