Buggy code:
@ Controller @ RequestMapping ( "//manageTraining//importTraining" ) public class ImportTrainingController { private static final Logger logger = Logger . getLogger ( ImportTrainingController . class ) ; @ Autowired UserService userService ; @ Autowired CompletedTrainingService completedTrainingService ; @ Autowired AddressService addressService ; @ RequestMapping ( method = RequestMethod . GET ) protected ModelAndView handleRequestInternal ( HttpServletRequest arg0 , HttpServletResponse arg1 ) throws Exception { } @ RequestMapping ( method = RequestMethod . POST ) protected ModelAndView handlePostRequest ( @ RequestParam ( "trainingTypeId" ) String trainingTypeId , @ RequestParam ( "year" ) String year , @ RequestParam ( "month" ) String month , @ RequestParam ( "day" ) String day , @ RequestParam ( "importFile" ) MultipartFile importFile ) throws Exception { importFile . isEmpty ( ) ; ModelAndView mav = new ModelAndView ( "manageTraining//importTraining" ) ; String paramValidMsg = TrainingExcelValidator . validateImportExcelInputParams ( trainingTypeId , year , month , day , importFile ) ; mav . addObject ( "isNotMainPage" , new Boolean ( true ) ) ; mav . addObject ( "isPublicPage" , new Boolean ( false ) ) ; mav . addObject ( "backUrl" , "//manageTraining" ) ; if ( ! ( "" . equals ( paramValidMsg ) ) ) { mav . addObject ( "validationMsg" , paramValidMsg ) ; return mav ; } File file = new File ( importFile . getOriginalFilename ( ) ) ; importFile . transferTo ( file ) ; String excelFileContentCorrectMsg = null ; try { excelFileContentCorrectMsg = ExcelImportHelper . validateExcelFileContent ( file ) ; } catch ( Exception e ) { excelFileContentCorrectMsg = Constants . VALIDATION_EXCEL_PROBLEM_DURING_OPENING_EXCEL ; } if ( ! ( "" . equals ( excelFileContentCorrectMsg ) ) ) { mav . addObject ( "validationMsg" , excelFileContentCorrectMsg ) ; return mav ; } List < TrainingExcelDto > trainingAttendendList = ExcelImportHelper . importTrainingExcel ( file ) ; String excelValuesValidMsg = TrainingExcelValidator . validateTrainingExcelList ( trainingAttendendList ) ; if ( ! ( "" . equals ( excelValuesValidMsg ) ) ) { mav . addObject ( "validationMsg" , ( paramValidMsg + excelValuesValidMsg ) ) ; return mav ; } DateTime complDt = new DateTime ( new Integer ( year ) , new Integer ( month ) , new Integer ( day ) , 0 , 0 , 0 ) ; Date complDate = complDt . toDate ( ) ; for ( TrainingExcelDto item : trainingAttendendList ) { <START_BUG> Long userId = userService . createUserWithAddress ( item , true ) ; <END_BUG> CompletedUserTrainingDto newComplTraining = new CompletedUserTrainingDto ( userId , new Long ( trainingTypeId ) , complDate ) ; BooleanResponse completedUserTrainingCheckResult = completedTrainingService . isCompletedTrainingExist ( newComplTraining ) ; if ( completedUserTrainingCheckResult . getPrimitiveBooleanValue ( ) ) { continue ; } completedTrainingService . create ( new CompletedUserTrainingDto ( userId , new Long ( trainingTypeId ) , complDate ) ) ; } ImportTrainingController . logger . debug ( "Processing<seq2seq4repair_space>POST<seq2seq4repair_space>request<seq2seq4repair_space>for<seq2seq4repair_space>importTraining<seq2seq4repair_space>page.." ) ; mav . addObject ( "isImportSuccess" , new Boolean ( true ) ) ; return mav ; } public void setUserService ( UserService userService ) { } public void setCompletedTrainingService ( CompletedTrainingService completedTrainingService ) { } public void setAddressService ( AddressService addressService ) { } }

Fix:
Long userId = userService . createUserWithAddress ( item ) ;