This blog post provides a step-by-step guide that works worry free :

http://erikvanpaassen.tweakblogs.net/blog/12480/turning-a-raspberry-pi-into-a-unifi-controller-appliance-%28unifi-4-raspbian-jessie-oracle-java-8%29

Thanks to the author !

As the versions are regularly upgraded, I would suggest you to parse the file : /etc/init.d/unifi and update the path (java home and controller application, if needed). Then, run the commands :

update-rc.d unifi defaults

Then, test the startup script with :

/etc/init.d/unifi restart

This man-page gives you instructions about managing services at startup : http://manpages.ubuntu.com/manpages/hardy/man8/update-rc.d.8.html