method 동적 호출

JAVA 2019. 2. 27. 14:20

method 동적 호출



package egovframework.kr.co.jnjkorea.crm.web;


import javax.annotation.Resource;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.springframework.stereotype.Controller;

import org.springframework.ui.ModelMap;

import org.springframework.web.bind.annotation.RequestMapping;

import egovframework.kr.co.jnjkorea.crm.service.CommonCRMBeanFactory;

import egovframework.kr.co.jnjkorea.crm.service.CommonCRMService;

import egovframework.kr.co.jnjkorea.portal.util.service.WebFactory;

import egovframework.kr.co.jnjkorea.portal.util.service.ZValue;

import java.lang.reflect.Method;




@Controller

public class CommonCRMController {

protected Log log = LogFactory.getLog(this.getClass());


@Resource(name = "commonCRMBeanFactory")

protected CommonCRMBeanFactory commonCRMBeanFactory;


@RequestMapping("/crm/*/list.do")

public String list(HttpServletRequest request,HttpServletResponse response,ModelMap model) throws Exception {


Zvalue zvl = WebFactory.getAttributesInit(request);


CommonCRMService = commonCRMService = commonCRMBeanFactory.getBeen(zvl.getString("uBinId"));

Method dymMethod = null;


Class[] cParam = new Class[]{ZValue.class, ModelMap.class};

Object[] oParam = new Object[]{zvl, model};


dymMethod = commonCRMService.getClass().getMethod("list", cParam);

dymMethod.invoke(commonCRMService, oParam);


//commonCRMService.list(zvl, model);


return "crm/" + zvl.getString("uBinId") + "/list";

}

}

'JAVA' 카테고리의 다른 글

multipart 케스팅  (0) 2019.02.28
multipart 리졸버  (0) 2019.02.28
MD5 암호화 예제  (0) 2019.02.27
mac address  (0) 2019.02.15
Listener :: ServletContextListener  (0) 2019.02.15
블로그 이미지

마크제이콥스

초보 개발자의 이슈및 공부 내용 정리 블로그 입니다.

,