Can I declare a Service injection as static in my Controller?
For example :
@Inject private static UserAttributeService userService;
Update : My requirement was to initialize a Map in static block. The map will be unmodifiable, but it will be initialized after a database call.
But its not being allowed as non static Service layer cannot be called from static block. I havent tried declaring my Service injection as static as I am not sure if its a good practice.
static {
crudService.executeNamedQuery(DBOperation.SELECT, "someQuery", null, null);
}