private static void addRedisServiceBuilder()

in plugin/src/main/groovy/grails/plugins/redis/ast/AbstractMemoizeASTTransformation.groovy [146:164]


    private static void addRedisServiceBuilder(ClassNode cNode, String propertyName,
                                               Class propertyType = Object.class,
                                               Expression initialValue = null) {
        def ast = new AstBuilder().buildFromString("return Holders?.findApplicationContext()?.getBean('redisService')")

        FieldNode fieldNode = new FieldNode(
                propertyName,
                ACC_PUBLIC,
                new ClassNode(propertyType),
                new ClassNode(cNode.class),
                initialValue
        )

        def returnStatement = new ReturnStatement(ast[0].statements[0].expression)

        def propertyNode = new PropertyNode(fieldNode, ACC_PUBLIC, returnStatement, null)
        cNode.addProperty(propertyNode)

    }