Can gradle change the scope of a specific sub-dependency?

My issue replay:
gradle version:7.1

I want to add a third-party dependency in my spring-boot project, so here I write this( has been located by red square frame in the picture below) in build.gradle file, and after download action over, I saw this relationship of dependency tree along with it’s version information of each sub-dependency.


So the issue is rolled out: How to change scope of a specific sub-dependency? By the way, what’s the principle of delineating the scope of a specific sub-dependency?
I had made some efforts to solve it :
There is one sub-dependency (such as org.springframework.boot:spring-boot-autoconfigure2.5.4 ) I want to use in my project compilation. I want to change the scope of it. After reference to the Gradle official site document, I tried some configurations which suggest me to use configurations block to aggregate some classpathes to make it work in build.gradle file, but it does not work finally.

So I have to add the specific sub-dependency in build.gradle file by declarative code to solve the issue: api ‘org.springframework.boot:spring-boot-starter:2.5.3’

|||If I had not realized the given version of the sub-dependency which here is 2.5.4 and add a different version such as 2.5.3 by declarative code :sweat_smile:. The fact turns out to be some duplicate dependencies existing in my project and it just caused by the inmutability of version information of a sub-dependency. As I am a newbie for Gradle, I’m sorry if the question contians some immature opinions or any other that are unappropriate.
Any response will be appreciated! My Email: XLYS.XLJ.000@gmail.com|