Source:
<code>public boolean validate(AttributedDocumentEvent event) { LOG.debug("validate start"); boolean isValid = true; CuDisbursementVoucherDocument document = (CuDisbursementVoucherDocument) getAccountingDocumentForValidation(); DisbursementVoucherPayeeDetail payeeDetail = document.getDvPayeeDetail(); if (!payeeDetail.isEmployee() || payeeDetail.isVendor() || !(document.getDocumentHeader().getWorkflowDocument().isInitiated() || document.getDocumentHeader().getWorkflowDocument().isSaved())) { return true; } String employeeId = payeeDetail.getDisbVchrPayeeIdNumber(); <START> Person employee = personService.getPersonByEmployeeId(employeeId); <END> MessageMap errors = GlobalVariables.getMessageMap(); errors.addToErrorPath(KFSPropertyConstants.DOCUMENT); WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); boolean stateIsInitiated = workflowDocument.isInitiated() || workflowDocument.isSaved(); if (ObjectUtils.isNull(employee)) { employee = SpringContext.getBean(PersonService.class).getPerson(employeeId); } else { if (!KFSConstants.EMPLOYEE_ACTIVE_STATUS.equals(employee.getEmployeeStatusCode()) && !CUKFSConstants.EMPLOYEE_RETIRED_STATUS.equals(employee.getEmployeeStatusCode())) { if(stateIsInitiated) { String label = dataDictionaryService.getAttributeLabel(DisbursementVoucherPayeeDetail.class, KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER); errors.putError(DV_PAYEE_ID_NUMBER_PROPERTY_PATH, KFSKeyConstants.ERROR_INACTIVE, label); isValid = false; } } } if (employee == null) { String label = SpringContext.getBean(DataDictionaryService.class).getAttributeLabel( DisbursementVoucherPayeeDetail.class, KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER); errors.putError(DV_PAYEE_ID_NUMBER_PROPERTY_PATH, KFSKeyConstants.ERROR_EXISTENCE, label); isValid = false; } errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT); return isValid; }</code><technical_language>some of SpringContext calls cleaned in this file. Please clean other instances if feasible</technical_language>

Target:
public boolean validate(AttributedDocumentEvent event) { LOG.debug("validate start"); boolean isValid = true; CuDisbursementVoucherDocument document = (CuDisbursementVoucherDocument) getAccountingDocumentForValidation(); DisbursementVoucherPayeeDetail payeeDetail = document.getDvPayeeDetail(); if (!payeeDetail.isEmployee() || payeeDetail.isVendor() || !(document.getDocumentHeader().getWorkflowDocument().isInitiated() || document.getDocumentHeader().getWorkflowDocument().isSaved())) { return true; } String employeeId = payeeDetail.getDisbVchrPayeeIdNumber(); Person employee = personService.getPersonByEmployeeId(employeeId); MessageMap errors = GlobalVariables.getMessageMap(); errors.addToErrorPath(KFSPropertyConstants.DOCUMENT); WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); boolean stateIsInitiated = workflowDocument.isInitiated() || workflowDocument.isSaved(); if (ObjectUtils.isNull(employee)) { employee = personService.getPerson(employeeId); } else { if (!KFSConstants.EMPLOYEE_ACTIVE_STATUS.equals(employee.getEmployeeStatusCode()) && !CUKFSConstants.EMPLOYEE_RETIRED_STATUS.equals(employee.getEmployeeStatusCode())) { if(stateIsInitiated) { String label = dataDictionaryService.getAttributeLabel(DisbursementVoucherPayeeDetail.class, KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER); errors.putError(DV_PAYEE_ID_NUMBER_PROPERTY_PATH, KFSKeyConstants.ERROR_INACTIVE, label); isValid = false; } } } if (employee == null) { String label = dataDictionaryService.getAttributeLabel( DisbursementVoucherPayeeDetail.class, KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER); errors.putError(DV_PAYEE_ID_NUMBER_PROPERTY_PATH, KFSKeyConstants.ERROR_EXISTENCE, label); isValid = false; } errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT); return isValid; }