This paper summarizes the painting injection optimization for the Chinese Spallation Neutron Source (CSNS) ring. This optimization focuses on two main design goals: the lower beam loss and a space-charge tune shift low enough to avoid strong resonances. Finally, the 3-D particle tracking is performed and we get some important results about the beam properties and beam loss.