Cavitation significantly influences fuel mixture preparation and combustion of IC engines which are the main power source of transportation. Investigation of cavitation in injector and its effect on spray breakup is very important for reduction of emissions and fuel consumption. To study the cavitation dynamics and primary breakup, highly resolved microscopic imaging technique was employed with an enlarged transparent nozzle and a real-sized nozzle under various throttling conditions. Mechanisms of cavitation generation were investigated through the cavitation generation locations and morphologies. The characteristics of the secondary vapor bubbles were also probed by injecting diesel into the liquid based on the differences of density and refraction between liquid and vapor. It was found that under low pressure, dynamic cavitation which developed and receded bi-directionally was observed close to the inlet. Cavitation in the sac and nozzle inlet was mainly throttling induced under low pressure and redirection induced under high pressure, while cavitation at nozzle outlet was mainly redirection induced. Increasing pressure strengthened cavitation at both inlet and outlet, and made the vapor bubbles more compact and deformed. Decreasing throttling effect enhanced the cavitation before weakening. Besides, vapor bubbles collapsed very quickly at the nozzle outlet due to the abrupt pressure reduction.