grails-spring-security-core
grails-spring-security-core copied to clipboard
Table per hierarchy on User class causes application not to start
- [x] Steps to reproduce provided
- [x] Stacktrace provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)
Steps to Reproduce
- Create a grails app
- Install spring security core plugin
compile 'org.grails.plugins:spring-security-core:4.0.0' - Add "tablePerHierarchy false" to User class
- Extend another class from User
Expected Behaviour
It should create a separate table for the extended class.
Actual Behaviour
Application doesn't start and throws:
Disconnected from the target VM, address: '127.0.0.1:39131', transport: 'socket' 2020-05-08 19:15:10.534 ERROR --- [ restartedMain] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'authenticationProcessingFilterDeregistrationBean': Cannot resolve reference to bean 'authenticationProcessingFilter' while setting bean property 'filter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationProcessingFilter': Cannot resolve reference to bean 'authenticationManager' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager': Cannot resolve reference to bean 'daoAuthenticationProvider' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoAuthenticationProvider': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService': Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NullPointerException 2020-05-08 19:15:10.584 ERROR --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
The problem occurs only when trying to extend from the User class, it works ok with any other class.
Environment Information
- Operating System: Linux Manjaro
- GORM Version: 7.0.4
- Grails Version: 4.0.3
- JDK Version: 1.8 openjdk
Example Application
Github repository with example that reproduces the issue: https://github.com/richardvil/spring-security-core-user-hierarchy-error
Same error is happening on Grails 6.1, JDK 11.0.3, Gorm Version: 8.0.0, groovyVersion: 3.0.11