DEV Community

Eric Helgeson
Eric Helgeson

Posted on

4

Wiring Micronaut beans in Grails Services

Micronaut beans in Grails 4 are wired by type - not the default Grails users are used to using - wire by name.

For example if we have a micronaut-http-client bean named MyRestClient under src/main/groovy/<package>/MyRestClient.groovy and we want to wire it into the Grails service SomeService we must supply the type:

class SomeService {
    // ❌ wont work, as Grails will look for a bean name that wont exist.
    // def myRestClient

    // ✅ Works!
    MyRestClient myRestClient
}

Tested on Grails 4.0.2.

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more