Quantcast
Channel: Active questions tagged atlassian-plugin-sdk - Stack Overflow
Viewing all articles
Browse latest Browse all 280

Setter Injection with @ComponentImport

$
0
0

Hi I'm trying to modify a Confluence Plugin to check every Network request against the OutboundWhitelist, however the plugin is written in a way where adding it into the constructor breaks quite a few things and causes quite a headache.I wanted to know if it is possible to somehow do this in a different way.

I tried using @ComponentImport on the field itself and tried other things like @Inject and @Autowired.However with all of these the OutboundWhitelist was null and the resulting code did not work.

Did I miss something or is adding @ComponentImport to the Constructor really the only way to achieve this behaviour?

Any help is appreciated.Edit: Added Code Samples.

This is what I'd like to avoid

private final OutboundWhitelist outboundWhitelist;public YourMacro(@ComponentImport OutboundWhitelist outboundWhitelist) {   this.outboundWhitelist = outboundWhitelist;}

This is what I'd like to do:

public void setOutboundWhitelist(OutboundWhitelist ow) {      this.outboundWhitelist = ow;  }  

Viewing all articles
Browse latest Browse all 280

Trending Articles