You can set the read preference on multiple levels: the client, the database, the collection and finally on individual query.
If you set the read preference on the MongoClient with
mongoClient.setReadPreference(secondary());
then this is the default read preference that will be used for all queries, unless you define otherwise. You need to ensure you set this before running any queries, or it will not take effect.
If you set a read preference on a collection using:
collection.setReadPreference(primary());
this would override your MongoClient settings, and the primary would be used by default when accessing this collection (see this blog post as well to understand how read preferences work at a collection level.
Finally, you could further override the preference for some individual queries, like the methods you found that are deprecated.