Hello everyone,
Sorry to bother you but I am currently implementing a feature in one of our add-ons that requires using the UserPropertyService to have access to User Entity Properties. The problem is that User Entity Properties were added on JIRA 7.0 and our add-on provides compatibility down to JIRA 6.4.1. That means our code base is compiled against the lower version were the required service class is not available.
I am going to use a snippet of Java code to illustrate my problem. The following piece of code which is compatible with JIRA 7+, does not compile using JIRA 6.4 APIs:
@Scanned
public class MyComponent
private UserPropertyService userPropertyService;
@Autowired
public MyComponent(@ComponentImport UserPropertyService userPropertyService) {
this.userPropertyService = userPropertyService;
}
}
to overcome this I have tried using the Object class like this, so that the code compiles and then the dependencies are injected on runtime when using JIRA 7+:
@Scanned
public class MyComponent
private Object userPropertyService;
@Autowired
public MyComponent(@ComponentImport Object userPropertyService) {
this.userPropertyService = userPropertyService;
}
}
but unfortunately, the injection is performed by type and there is no way to use a qualifier based on name. If it worked I could then use reflection in those cases where the runtime is JIRA 7+ and ignore when on JIRA 6.4
I have also tried to use reflection, but since the UserPropertyService class is part of an external component/module, this attempt was also unsuccessful.
Does anyone know any other alternative to solve this conundrum, besides dropping JIRA 6.4 support?
Thanks just for reading
Angel