Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception testing a controller or a service with a service injected with autowired #67

Open
xavier-gallofre opened this issue Jul 26, 2020 · 0 comments

Comments

@xavier-gallofre
Copy link

grails version: 3.3.11

Given a controller unit test that have a service injected with an autowired annotation It throws an exception NoSuchBeanDefinitionException.

I've reproduced the issue on a repository. It's been created with grails version 3.3.11, an item class domain and some code generated with scaffolding. I've left the test working and made the change on ItemController injecting the service with autowired on the last commit.

Git Repository with an example: https://github.com/xavier-gallofre/grails-test-autowired-issue

es.xagani.grailsTestAutowired.ItemControllerSpec > Test the index action returns the correct model FAILED
    org.springframework.beans.factory.UnsatisfiedDependencyException at ItemControllerSpec.groovy:18
        Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException at ItemControllerSpec.groovy:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant