java - Code quality - order of @Autowired member variables? -
how order member variable fields when using injecte @autowired
, @value
annotations spring
?
would consider following example best practice?
public class myexample { private static final logger logger; private static final int static_var = 1; @autowired private webservice service; @value("${my.property}") private string property; //to set setter or constructor private mailservice mail; }
i'm not sure order of instance members matters. said, set them through constructor can final:
public class myexample { private static final logger logger; private static final int static_var = 1; private final webservice service; private final string property; private final mailservice mail; @autowired public myexample(webservice service, @value("${my.property}") string property) { this.service = service; this.property = property; mail = new mailservice(); } }
Comments
Post a Comment