package com.swagger.ui.controller;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.swagger.ui.bean.Student;

@RestController
//@Controller
@RequestMapping("/api")
public class SwaggerDemoController {
	
	@GetMapping("/viewStudent")
	public ResponseEntity show() {
		
		
		return new ResponseEntity(new Student(),HttpStatus.OK);
	}
	
	@GetMapping("/test")
    public void  test() throws InterruptedException{	
		int count=0;
		while(true) {
			System.out.println("while loop "+count++ +""+Thread.currentThread());
			Thread.sleep(5000);
		}
		
		
	}
	BeanFactory b;
	
	@GetMapping("/testparam")
	public ResponseEntity testParam(@RequestParam("str") String str, @RequestParam("gnbs") String[] gnbs){
		
		System.out.println(str);
		//System.out.println(gnbs);
		for(int i=0;i< gnbs.length;i++) {
			System.out.println(gnbs[i]);
		}
		return new ResponseEntity(new Student(),HttpStatus.OK);
	}
	

}