gpc / greenmail

Adds an in memory SMTP server to grails apps for testing email sending
http://grails.org/plugin/greenmail
Apache License 2.0
14 stars 26 forks source link

greenmail bean is null #6

Closed stokito closed 1 year ago

stokito commented 11 years ago

Greenmail been is null and can't be autowired. I've fixed this problem and will send pull request later. But I'm not sure why this error happens, so I want to describe it. It looks like something changed in Spring beans DSL.

This code not work in Grails 2.2.2 and 2.2.3

    def doWithSpring = {
            ...
            greenMail(GreenMail, [smtp] as ServerSetup[]) { 
                it.initMethod = 'start'
                it.destroyMethod = 'stop'
            }
        }
    }

As I know Groovy lang variable it is referenced to first argument of closure. Maybe now there is more args, or something else, but now it not working. If you define closure arguments directly all works as expected:

    def doWithSpring = {
            ...
            greenMail(GreenMail, [smtp] as ServerSetup[]) { bean ->
                bean.initMethod = 'start'
                bean.destroyMethod = 'stop'
            }
        }
    }

Same problem is in dumbster plugin.

github-actions[bot] commented 1 year ago

This issue looks like it is stale and therefor it is in risk of being closed with no further action.