A few things you need to consider separately here.
Regardless of clients, if you want to upgrade from EE 3.7.1 to EE 4.2 you need to go through EE 3.13, which is a jump version. You first need to do a rolling upgrade to EE 3.13 and switch the clustering protocol. Version 4.2 has a different, more efficient storage format. You can do a rolling upgrade from EE 3.13 to EE 4.2 and handle the format change node by node.
The Java client needs certain server versions for certain features, for example using the atomic MapOperation API, so you won’t be able to use those before you’re ahead of EE 3.7.1. You can look at the release notes of the Java client to see if there are any incompatible API changes that require modification in your application.
aerospike/spring-data-aerospike is a community project, seeded by Aerospike, and contributed by several others (heavily by Playtika, for example). If you look at the pom.xml, it’ll build with Java client 4.1.8. As with any change, stage this before trying to roll out to production. I don’t believe you need to make changes if you’re already using the latest Spring Data for Aerospike.