This is true if the application needs to talk to the slaves directly. If the application doesn't care, then you could do the smarts in the proxy layer underneath the application. I see three scenarios:
* Stateless or Transparent master/master backend
Example: Memcached cluster
Use load balancing in the proxy layer
* Failover backend with failover on server side
Examples: Mysql master/slave
Use failover logic in the proxy layer
* Failover backend with failover on the client side
Example: HA RabbitMQ cluster
Above suggestion from polvi is needed
* Stateless or Transparent master/master backend
* Failover backend with failover on server side * Failover backend with failover on the client side