File tree Expand file tree Collapse file tree
core/src/main/java/org/restheart/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,14 +101,21 @@ private static boolean enabled(PluginDescriptor plugin) {
101101
102102 // In native images, plugin.enabled() is forced to true at build time
103103 // to ensure all plugins are compiled into the image. At runtime we need
104- // the real enabledByDefault value from the annotation.
105- boolean enabledByDefault ;
106- try {
107- var clazz = Class .forName (plugin .clazz ());
108- var regPlugin = clazz .getAnnotation (RegisterPlugin .class );
109- enabledByDefault = regPlugin != null && regPlugin .enabledByDefault ();
110- } catch (ClassNotFoundException e ) {
111- enabledByDefault = plugin .enabled ();
104+ // the real enabledByDefault value from the annotation when no config
105+ // override exists.
106+ boolean enabledByDefault = plugin .enabled ();
107+
108+ if (pluginConf == null ) {
109+ // No config entry — check the annotation for the real default
110+ try {
111+ var clazz = Class .forName (plugin .clazz ());
112+ var regPlugin = clazz .getAnnotation (RegisterPlugin .class );
113+ if (regPlugin != null ) {
114+ enabledByDefault = regPlugin .enabledByDefault ();
115+ }
116+ } catch (ClassNotFoundException e ) {
117+ // keep plugin.enabled()
118+ }
112119 }
113120
114121 return PluginRecord .isEnabled (enabledByDefault , pluginConf );
You can’t perform that action at this time.
0 commit comments