Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Getting started

Alan Gomes edited this page Jul 6, 2020 · 11 revisions

The first step is to add the Spring boot starter to your project

<dependency>
  <groupId>dev.alangomes</groupId>
  <artifactId>spigot-spring-boot-starter</artifactId>
  <version>0.20.6</version>
</dependency>

Create a class to configure the Spring boot application

@SpringBootApplication(scanBasePackages = "me.test.testplugin")
public class Application {

}

Then create the plugin main class using the SpringSpigotBootstrapper helper.

public class ExamplePlugin extends JavaPlugin {

    private ConfigurableApplicationContext context;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        context = SpringSpigotBootstrapper.initialize(this, Application.class);
    }

    @Override
    public void onDisable() {
        context.close();
        context = null;
    }

}

And that's it! Your plugin is ready to use all features from Picocli and Spring Boot!

Note: If you are getting a No auto configuration classes found in META-INF/spring.factories error, it means that your build configuration must be wrong, see this issue for more details.

Clone this wiki locally