package org.ncomet.fibonaccispringaop.resource;

import org.ncomet.fibonaccispringaop.service.FibonacciService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/fibonacci/{n}")
public class FibonacciResource {

    private final FibonacciService fibonacciService;

    @Autowired
    public FibonacciResource(FibonacciService fibonacciService) {
        this.fibonacciService = fibonacciService;
    }

    @GetMapping
    public ResponseEntity<String> fibo(@PathVariable int n) {
        return ResponseEntity.ok("fibonacci(" + n + ") = " + fibonacciService.compute(n));
    }
}

@@ -216,16 +216,59 @@
 Entity;%0A
+import org.springframework.util.StopWatch;%0A
 import o
@@ -872,88 +872,280 @@
     
-return ResponseEntity.ok(%22fibonacci(%22 + n + %22) = %22 + fibonacciService.compute(n)
+StopWatch stopWatch = new StopWatch();%0A        stopWatch.start();%0A        long result = fibonacciService.compute(n);%0A        stopWatch.stop();%0A        return ResponseEntity.ok(%22fibonacci(%22 + n + %22) = %22 + result + %22%3Cbr/%3E It took %22 + stopWatch.getLastTaskTimeMillis() + %22ms%22
 );%0A 

add Stopwatch