[ONOS-8102] Moving get(MeterService.class) into each MetersWebResource Method to avoid startup race condition between Web resource and meter service class creation.

Change-Id: Ie1a14aeec91b54a120ccd3d14f9edc846426c857
(cherry picked from commit 6347ff4c46de1531856c3de318f73b62002fcc3c)
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/MetersWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/MetersWebResource.java
index 814b351..93d924a 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/MetersWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/MetersWebResource.java
@@ -60,7 +60,6 @@
     private static final String DEVICE_INVALID = "Invalid deviceId in meter creation request";
     private static final String METER_NOT_FOUND = "Meter is not found for ";
 
-    private final MeterService meterService = get(MeterService.class);
     private final ObjectNode root = mapper().createObjectNode();
     private final ArrayNode metersNode = root.putArray("meters");
 
@@ -73,6 +72,7 @@
     @GET
     @Produces(MediaType.APPLICATION_JSON)
     public Response getMeters() {
+        MeterService meterService = get(MeterService.class);
         final Iterable<Meter> meters = meterService.getAllMeters();
         if (meters != null) {
             meters.forEach(meter -> metersNode.add(codec(Meter.class).encode(meter, this)));
@@ -92,6 +92,7 @@
     @Path("{deviceId}")
     public Response getMetersByDeviceId(@PathParam("deviceId") String deviceId) {
         DeviceId did = DeviceId.deviceId(deviceId);
+        MeterService meterService = get(MeterService.class);
         final Iterable<Meter> meters = meterService.getMeters(did);
         if (meters != null) {
             meters.forEach(meter -> metersNode.add(codec(Meter.class).encode(meter, this)));
@@ -114,7 +115,7 @@
                                                  @PathParam("meterId") String meterId) {
         DeviceId did = DeviceId.deviceId(deviceId);
         MeterId mid = MeterId.meterId(Long.valueOf(meterId));
-
+        MeterService meterService = get(MeterService.class);
         final Meter meter = nullIsNotFound(meterService.getMeter(did, mid),
                 METER_NOT_FOUND + mid.id());
 
@@ -153,6 +154,7 @@
             final MeterRequest meterRequest = codec(MeterRequest.class)
                     .decode(jsonTree, this);
 
+            MeterService meterService = get(MeterService.class);
             final Meter meter = meterService.submit(meterRequest);
 
             UriBuilder locationBuilder = uriInfo.getBaseUriBuilder()
@@ -180,6 +182,8 @@
                                                 @PathParam("meterId") String meterId) {
         DeviceId did = DeviceId.deviceId(deviceId);
         MeterId mid = MeterId.meterId(Long.valueOf(meterId));
+
+        MeterService meterService = get(MeterService.class);
         final Meter tmpMeter = meterService.getMeter(did, mid);
         if (tmpMeter != null) {
             final MeterRequest meterRequest = meterToMeterRequest(tmpMeter, "REMOVE");