Spring Cloud Connectors can be used to parse the VCAP_SERVICES environment variable and provide the credentials in a Java object model. If you format that user-provided service instance credentials in a custom way, then you would need to write some extension code to tell Connectors how to parse the credentials.
A better way is to format the service instance credentials in a way that Connectors already understands. The easiest way to do this is usually by providing a single connection string. There are some hints in the Connectors docs showing the credentials formats that Connectors understands for various database types. So you could do something like this:
cf cups <service instance> -p '{"url", "mysql://username:password@hostname:3306/dbname"}'
cf cups <service instance> -p '{"jdbcUrl": "jdbc:mysql://hostname:3306/dbname?user=username&password=password"}'
or the equivalents for Postgres, Oracle, DB2, or SqlServer.
If you include the Spring Service Connector in your project, Connectors will detect the bound service and create the necessary connection objects (e.g. DataSource) for you.