The Rambam [Melachim 1/ 11] rules that a king from the House Of Dovid must be anointed next to a spring - אין מושחין אותן אלא על המעיין.
The source for the Rambam is the gemara in Horiyos [12a] and Krisus [5b]. The sefer Har Hamoriah [פ"א מהלכות כלי המקדש] asks why the Rambam neglected to cite an additional halacha from the gemara in Horiyos: Chana said רמה קרני - my horn is exalted, and not רמה פכי - My jug is exalted. Thus, Dovid and Shlomo who were anointed from a HORN, had a kingship that continued while Shaul and Yehu who were annointed from a jug had a kingdom that was stopped. So we see another halacha that the kings of Beis Dovid must be anointed from a horn. One could argue that the gemara is not stating a halacha but merely telling us what happened, however the Yerushalmi [Horiyos ch. 3 and Shkalim ch. 4] consider the notion of anointing with a horn a halachic obligation. So why did the Rambam omit this?
It seems that the Rambam has a source in the Bavli that it is not a halacha. See the gemara in Megila 14a where Rashi writes that anointing with a horn is a NEVUAH of Chana. So we see that Chana was just telling us what will happen in the future but was not teaching us an obligatory halacha.
Another possibility is to answer that anointing with a horn is merely a simman tov [what we would call a segula], as we see from the sefer עיון יעקב on Megilla. It is also mentioned in the context of simman tov's in the gemara in Horiyos. The Rambam doesn't pasken simman tovs, as is well known. However anointing next to a well is an obligation because it creates a reality whereby the kingdom will last, as explained by the Maharal in his chiddushim to Horiyos. So the Rambam paskens the reality and omits the "simman tov".
[עפ"י באר מרים למו"ר הגאון הגדול והמופלג ר' ד"י מן זצ"ל]