A method is provided for the rapid formation of a biocompatible hydrogel. Themethod involves admixing component A and component B to form a reactive mixturehaving specific crosslinking conditions, then the mixture forms a biocompatiblehydrogel by rapid crosslinking. The component A is a solution of the sulfhydrylderivatives of a biocompatible polymer. The component B is a biocompatible sulfhydryl-reactivecrosslinking agent. A spraying agent which is able to rapidly form hydrogel isprepared. And the uses of the spraying agent in the field of medicine are provided.