2

This is my code. I am trying to set the Init parameters dynamically. Currently java accepts only a String as the param. I need something like value = getValues(). The idea is to set the config value dynamically.

    @WebServlet(value = "/dwr/*", initParams = { @WebInitParam(name = "config", value = "<DYNAMIC>") })
public class O2DWRServlet extends DwrServlet {
    private static final long serialVersionUID = -2745056470448621968L;

}
  • Here's some information on what types are allowed in annotations: https://stackoverflow.com/questions/1458535/which-types-can-be-used-for-java-annotation-members – Druckles Oct 16 '19 at 13:16
  • In other words, exactly what you want isn't possible for two reasons: it's not allowed by Java, the type of `WebInitParam.value` is already defined. So you'll have to go about it some other way I'm afraid. – Druckles Oct 16 '19 at 13:17
  • Please see my answer at https://stackoverflow.com/a/74122524/466677 – Marek Gregor Oct 19 '22 at 08:57

0 Answers0