[x] Example that reproduces the problem uploaded to Github
[x] Full description of the issue provided (see below)
Steps to Reproduce
create normal service
package com.sinoregal.sonar
class CacheService implements InitializingBean{
RoleResourceRelationService roleResourceRelationService //this is gorm abstract service
void testRoleResourceRelationServiceIsNull() {
if(roleResourceRelationService == null) println "roleResourceRelationService in cacheService is null"
else println "roleResourceRelationService in cacheService normal"
}
...
}
2. create gorm service
package com.sinosonar.rbac.relation
@Service(RoleResourceRelation)
abstract class RoleResourceRelationService{
CacheService cacheService //this is normal grails service
void commandPermissionCheck(int roleId, String command) {
if(cacheService == null) println "cacheService in roleResourceRelationService is null"
else "cacheService in roleResourceRelationService normal"
}
}
3. call roleResourceRelationService.commandPermissionCheck and cacheService.testRoleResourceRelationServiceIsNull() in any controller
### Expected Behaviour
"roleResourceRelationService normal"
"cacheService normal"
### Actual Behaviour
"roleResourceRelationService in cacheService normal"
"cacheService in roleResourceRelationService is null"
also can set breakpoint to watch,will find the cacheService in roleResourceRelationService is null
### Environment Information
- **Groovy Version**: 2.4.15
- **Grails Version:** 3.3.5
- **JDK Version:** 1.8.0_181
- **Gradle Version:** 3.5
### Example Application
https://github.com/linchanghui/gorm-bug
### remark
i also try add @Autowired to cacheService in RoleResourceRelationService, Although it make cacheService in roleResourceRelationService be injected
such:
@Service(RoleResourceRelation)
abstract class RoleResourceRelationService{
@Autowired
CacheService cacheService
however it will result roleResourceRelationService in CacheService is null
Task List
Steps to Reproduce
class CacheService implements InitializingBean{ RoleResourceRelationService roleResourceRelationService //this is gorm abstract service void testRoleResourceRelationServiceIsNull() { if(roleResourceRelationService == null) println "roleResourceRelationService in cacheService is null" else println "roleResourceRelationService in cacheService normal"
... }
package com.sinosonar.rbac.relation @Service(RoleResourceRelation) abstract class RoleResourceRelationService{
}
@Service(RoleResourceRelation) abstract class RoleResourceRelationService{