Quick question : What's the ideal way to keep a spring on a shaft. The shaft can have a threaded end.
"Ideal" is in the eye of the beholder. This is one of those things that "depends". It depends on how much clearance you have, how much budget you have, how "professional" you want it to look, what tools and equipment you have available, how much force you're dealing with, how long you want it to last, how often someone will need to disassemble it, what environmental concerns you might have, and so on...
You can drill and pin it. You can get a shaft with a tapped end (like from Misumi). You can use a retaining ring. And more options. Your choice.