Grails dependency inject domain classes
- by Don
Hi,
The Grails manual shows this example of dependency injecting domain classes:
class Book {
def bookService
def buyBook() {
bookService.buyBook(this)
}
}
However, I tried this out, and bookService is null. My guess is that the dependency injection happens when an object is loaded from the DB, so the following will always return null
new Book().bookService
Can someone confirm this?