package com.groovy.exception import com.services.TestService import org.springframework.context.ApplicationContext import org.codehaus.groovy.grails.web.util.WebUtils /** * Created by pritom on 9/02/14. */ class CustomException extends RuntimeException { private static TestService testService; String message; List args = []; public CustomException(String message, List args) { this.message = message; this.args = args; } public String getMessage() { return this.toString(); } public List getArgs() { return this.args; } public String toString() { String _message = testService.getMessage(this.message, this.args); return _message } static { if(!testService) { ApplicationContext applicationContext = WebUtils.retrieveGrailsWebRequest().getApplicationContext(); testService = applicationContext.getBean("testService"); } } }
Showing posts with label WebUtils. Show all posts
Showing posts with label WebUtils. Show all posts
Monday, February 10, 2014
Use grails service from java class
Subscribe to:
Posts (Atom)