'Spring boot image container running in minikube not giving proper response

I am using a minikube from powershell (minikube start) I can do all the things successfully like creating the image of my spring boot rest API. Creating the container of it, all the things are working well. I am also using mySql so I am using docker network as well. Everything getting created successfully, only thing is once I hit the GET call of my API. It does not show the proper response. Following is the image of what I am getting after hitting the GET call

enter image description here

All the time I am getting result as 200 OK with value 1, for any value I send in 'name'.

Following is my controller:

@RestController public class StockController {

    @Autowired
    private StockService stockService;

    @GetMapping("/stock")
    public StockDetails getStockDetails(@RequestParam(value = "id") BigInteger stockId){
        return stockService.getStockById(stockId);
    }

    @PostMapping("/stock")
    public StockDetails saveStockDetails(@RequestBody StockDetails stockDetails){
        return stockService.saveStockDetails(stockDetails);
    }

    @GetMapping("/stockByName")
    public ResponseEntity<StockDetails> getStockByName(@RequestParam String name){
        return new ResponseEntity<>(stockService.getStockByName(name),HttpStatus.OK);
    }
}

Following is my application.properties

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://mysqldb:3306/db_spring_rest
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source