Yes of course. KMP does not force you how much code you want to share.
But ideally, you would have 1 Gradle subproject that contains the shared code and another subproject for your (Spring) backend.
I have an outdated sample, but you can still take a look at the Gradle setup:
https://github.com/hfhbd/ComposeTodo