Understanding Spring configuration dependency injection + Jira

Hi there,
I am writing a custom web panel condition with Atlassian SDK in a project with a Spring Configuration class. I am attempting to inject BrowseContext into my condition class, but maybe I’m doing it wrong.

My config class looks like:

@Configuration
class SpringBeans {
  @Bean
  public BrowseContext importBrowseContext() {
        return importOsgiService(BrowseContext.class, defaultOptions());
  }

  @Bean
  public MyCondition myCondition (BrowseContext browseContext) {
    return new MyConditionImpl(browseContext);
  }
}

And my component class looks like:

class MyConditionImpl implements MyCondition, Condition {
  private final BrowseContext browserContext;
  public void MyConditionImpl (BrowseContext bc) {
    browserContext = bc;
  }
  // init implementation
  // shouldDisplay implementation
}

What am I missing?

seeing if a comment bumps this…

Hi Rusty,

Not sure if it’s just the way you wrote it out, but looks like a typo in your constructor? Constructor does not need void return.

Ie:

class MyConditionImpl implements MyCondition, Condition {
  private final BrowseContext browserContext;
  public MyConditionImpl (BrowseContext bc) {
    browserContext = bc;
  }
  // init implementation
  // shouldDisplay implementation
}