Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.3.5
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Mac OS X 10.6.5, Grails 1.3.4, webflow plugin 1.3.6
Description
Creating this JIRA report as per suggestion in GRAILS-4141
When creating a webflow in a controller, and then trying to access an injected object, a NullPointerException is thrown, for example:
class MyController {
def springSecurityService
def myWebFlow = {
def user = springSecurityService.principal
// "Cannot access principal on null object" thrown
}
Note that trying to manually retrieve the beans results in the same exception:
class MyController implements ApplicationContextAware { ApplicationContext applicationContext def myWebFlow = { def springSecurityService = applicationContext.getBean("springSecurityService") // "Cannot access getBean on null object" thrown }
Issue Links
- relates to
-
GRAILS-4299
Controllers with WebFlow actions are inconsistent in accessing injected beans
-
-
GRAILS-4141
Webflow: Dependency injection not working
-
I am having the same issue. My flow is:
def runJobFlow = { create { def myCurrentUser = springSecurityService.getCurrentUser() on("submit").to "setJobParams" } setJobParams { } }A NPE is thrown on the springSecurityService use. The same exception is thrown when called outside of the start state block.
While in a non webflow action on the same controller
def testJob = { def myCurrentUser = springSecurityService.getCurrentUser() render "Hello ${myCurrentUser.username} and ${scriptEngine}" }that works just fine.
Scriptengine above was a resource in the springbeans resources.groovy that also does that same thing.
This is on grails 1.3.6 with webflow 1.3.7. Total show stopper for my use.