package com.demo.controller; import com.demo.service.DocumentService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.io.IOException; @RestController @RequestMapping("api/documents") @RequiredArgsConstructor public class DocumentController { @Autowired public final DocumentService documentService; @GetMapping("import") public String importDocument() { try { documentService.importDocument(); } catch (IOException e) { return "not ok" + e.getMessage(); } return "ok"; } }