Extension with a nested lazy property

I want to build an extension that has a nested property inside.
I’ve tried to use lazy properties and latest guidelines but it doesn’t work, so I think I’m missing something.

In the current form, the script crashes on evaluation, with message:

> Failed to apply plugin class 'MyPlugin'.
   > Could not create an instance of type MyExtension.
      > Could not generate a decorated class for type MyExtension.
         > Cannot have abstract method MyExtension.getDevTarget().

I suspect the problem is in the line
abstract DevTarget getDevTarget()
Maybe the field is not managed? The correct syntax is different?

Gradle version is 6.9.1, java is 8, language is Groovy.
The simplified code is below:

apply plugin: MyPlugin

abstract class DevTarget {
    abstract Property<String> getUrl()
    abstract Property<String> getUser()
}

abstract class MyExtension {
    abstract DevTarget getDevTarget()
}

class MyPlugin implements Plugin<Project> {

    void apply(Project project) {
        project.extensions.create("myx", MyExtension)
    }
}


// test config
myx {
    devTarget {
        url = 'dev url'
        user = 'dev user'
    }
}

task show {
    doLast {
        println "DevTarget: ${myx.devTarget.url.get()}"
    }
}
abstract class MyExtension {
    @Nested
    abstract DevTarget getDevTarget()
    def devTarget(Action<DevTarget> action) {
        action.execute(devTarget)
    }
}

Indeed, this works, thank you.

Is this the best solution? I can live with it, but I wonder if there doesn’t exist a managed type that can solve this problem in a more concise way, without the @Nested annotation and the Action method:

abstract SomeManagedType<DevTarget> getDevTarget()

At least none I’m aware of.