Spray is an elegant Framework in many ways. Here is my opinion on how to arrange your controllers(actions) in your projects, so that you can easily maintain them and test them.
You will find that I didn’t use class to extend Actor. I only use trait in these files.
Here is your route actor, which will combine all the controller traits.
This part is like Global in Play framework, used to start your application. We launch our route actor here.
I believe this arrangement fits most cases.
Most people would like request handler to be separated in several files, grouping the controllers according to the related features. If people want to change anything or add anything, they can easily locate the place.
It’s clean. There will be no association with the Akka system in the middle of your real logic.
You might have noticed that since we use trait to build controllers, we can test our controllers without getting hands dirty with Akka.