To use a member variable in static function I need to declare that member variable as static. Is there anything wrong in declaring static fields and injecting them via constructor injection in multithreaded environment ?
@Named
public class QueryHelper {
// Anything wrong to declare it static and injecting it via constructor injection ?
private static QueryUtil queryUtil;
@Inject
QueryHelper(final QueryUtil queryUtil) {
this.queryUtil = queryUtil;
}
public static List<Contracts> getContracts() {
// .. some code
queryUtil.someFunction();
// ..some code
return contractList();
}
}