Have to preserve a cake for decoration purposes
The first thing would be making it as hollow as possible (probably eating the removed matter) ... the less massive it is, the easier it will be to treat. 

Just spraying something on will not help unless the inside mass is either very dry (water activity) or sterile (won't be unless it was heated through to >120°C ... no it wasn't during baking!). 

You would need to either replace ALL water in it with something else, or make sure ALL water is bound up or poisoned - all even harder to do without making it dangerous to a misguided person (children and animals! "Looks like food but is poison" is always an accident waiting to happen) mistaking it for an edible cake... it might be possible though, if you can get it down to a thin inner layer close to the icing - and manage not to damage the icing. A massive amount of salt would be the most obvious agent (and if someone eats it by accident, they will quickly realize they cant eat it) ... but would need to be sealed in too in order not to attract more moisture that will dissolve salt and icing.

Sealing the cake in and treating it with ionizing radiation to the point of sterilizing it would be rather impractical, heating it to the point would discolor, crack or melt it.

If you are lucky, the bare icing and decoration (if you can get it that hollow while preserving structural integrity long enough to backfill it with something inert) is dry enough/can be dried enough to be microbe and mold-proof, like lump sugar would be - even then, do not forget to deal with insects that would go for dry sugar.

Sealant? Maybe, just maybe, sodium silicate, since it has historically been used near food (egg preservation).