Skip to content

How to update the ‘List<Greeting>’ while some plugins unloaded and deleted?  #62

@jeven2016

Description

@jeven2016

Hi,

Could you take a look at this questions?

Question: How to update the ‘List’ bean while some plugins are unloaded/deleted?

public class Greetings {

  @Autowired
  private List<Greeting> greetings;

  public void printGreetings() {
    System.out.println(String
        .format("Found %d extensions for extension point '%s'", greetings.size(),
            Greeting.class.getName()));
    for (Greeting greeting : greetings) {
      System.out.println(">>> " + greeting.greeting());
    }
  }

}
  1. At the begining, there're 3 extensions found
Found 3 extensions for extension point 'api.Greeting'
>>> custom
>>> Plugin2Greeting
>>> Plugin1Greeting
  1. And I'd like to unload plugin-1 and try to replace it with a new plugin latter
  @GetMapping("uninstall/{pluginId}")
  public Flux<String> uninstall(@PathVariable String pluginId) {
    pluginManager.stopPlugin(pluginId);
    pluginManager.unloadPlugin(pluginId);
    return Flux.just("ok");
  }

  1. unfortunately, there're still be 3 extensions printed after the plugin-1 is unloaded.....

So how to update the bean 'List' during runtime, or any samples illustrate how to integrate with pf4j-update?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions