2017-02-22 2 views
0

나는 gsp를 pdf로 변환해야하는 grails 3 (grails 버전 3.2.3, java version 1.8) 프로젝트에서 작업 중이다. grails에서 제공하는 렌더링 플러그인을 사용하려고했습니다. 내가 사용 플러그인 수입 : 내 build.gradle 파일grails 렌더링 플러그인 호환되지 않는 반환 형식 문제

과 내 컨트롤러 에 compile 'org.grails.plugins:rendering:2.0.3' 을 내가 사용 :

ByteArrayOutputStream bytes = pdfRenderingService.render(template: "/templates/pdf_PI", model: [proformaInvoice: proformaInvoice]) 

가 PDF 파일을 렌더링 할 수 있습니다. 이 서비스는 내가 작업이 플러그인을 얻으려고 시간을 보냈다하지만 그냥 작동하지 않습니다이 오류

grails-app/controllers/chsam/re/ProformaInvoiceController.groovy: -1: The return type of java.lang.Object getPdfRenderingService() in chsam.re.ProformaInvoiceController is incompatible with grails.plugins.rendering.pdf.PdfRenderingService in grails.plugins.rendering.RenderingTrait. At [-1:-1] @ line -1, column -1. 

을 받고 있어요 그러나 def pdfRenderingService

사용하여 주입한다. 도와주세요.

+0

PLZ를 사용

Grails는 3.2.11에 작품

, 종속 { 런타임 'org.springframework : 봄 테스트 : 4.1.6.RELEASE' } –

+0

이 컴파일을 추가하십시오 "조직 .grails.plugins : rendering : 2.0.0-SNAPSHOT "이 컴파일을 추가하는 대신 org.grails.plugins : rendering : 2.0.3 ' –

답변

0

서비스를 선언 할 때 명시 적으로 유형을 사용하여이 문제를 해결했습니다. def pdfRenderingService 대신 PdfRenderingService pdfRenderingService을 사용하십시오. 추가이 dependencie을 의존성을 org.grails.plugins:rendering:2.0.3