다른 프로젝트 ("com.services")와 같은 이름의 에 다른 클래스를 확장하는 클래스 java ProductManager가 있습니다.그녀의 저녁 클래스에서 구현되는 클래스의 메소드 호출
수퍼 클래스에있는 deleteProduct (Long productId) 메소드를 호출해야합니다.
try{
Object service = CONTEXT.getBean("ProductManager");
Method method = service.getClass().getDeclaredMethod("deleteProduct", Long.class);
method.invoke(service, productId);
} catch(Exception e){
log.info(e.getMessage());
}
나는 제품 삭제할 수 없습니다
: 당신이 그 방법을 무시하는 경우
공개하려고하는 방법입니까? 이 메서드는 클래스에서 재정의됩니까? – Pshemo
예, 공개되었지만 클래스에서 재정의되지 않았습니다. – junior