Annotation Interface Configuration


@Target(TYPE) @Retention(RUNTIME) public @interface Configuration
Marks a class that declares Bean methods.

Configuration classes in the plugin's package are discovered automatically. They are created like services (constructor and field injection), but only once one of their beans is needed.

 @Configuration
 public class StorageBeans {
     @Bean
     public Storage storage(StorageConfig config, JavaPlugin plugin) {
         return config.type.equals("mysql") ? new MySQLStorage(plugin, config) : new SQLiteStorage(plugin);
     }
 }