Brahmanas, Kshatriya, and Vaishyas all undergo Upanayanam as early as 7 years of age. Having done Upanayanam, they become Brahmacharis.
One important vow of Brahmacharya is maintenance of celibacy, meaning no intentional emission of semen (masturbation or sex).
Here is what the Manusmriti says:
Persons learned in the Veda and knowing the law declare that for the twice-born person keeping up his vows, the intentional emission of semen means a ‘transgression of the vow.’—(120)
This vow is very important to be maintained, as stated in the next verse:
The spiritual power of the Religious Student (Brahmachari), who has become ‘immoral,’ (Avakirnin) ‘goes away into the Maruts, Indra, Bṛhaspati and Agni.—(121)
In fact, that's the reason given in the Apastamba sutras as to why no Rishis are born in kali yuga:
The word 'austerity' (must be understood to apply) to (the observance of) the rules (of studentship).
If they are transgressed, study drives out the knowledge of the Veda acquired already, from the (offender) and from his children.
Besides he will go to hell, and his life will be shortened.
On account of that (transgression of the rules of studentship) no Rishis are born amongst the men of later ages (Kali yuga).
So my question is, is there any work of any Acharya or any Hindu scripture that talks about how to tell young Brahmachari boys to preserve their semen?