Spring Security
  1. Spring Security
  2. SEC-826

Support for JPA PersistenceContext annotation broken

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Spring 2.5.4

      Description

      When using the intercept-methods tag on a bean, the dao's used by the userSecurityService and the protected bean are not processed by the
      PersistenceAnnotationBeanPostProcessor. This seems to be because the dao gets created before the PostProcessor and so in never seen by it. This like SEC-750 causes a null pointer when an attempt is made to authenticate the user.

      I believe that this is related to SEC-750 and SEC-773 however it still occurs in 2.0.0/2.5.4

      I have modified the test case form SEC-750 to demonstrate the problem. The unmodified test case runs fine on my system.

      My real world case is a little more complex in that I have a userSecurityService that uses one of my service components, that in turn uses a DAO that is used by another protected service.

        Activity

        Hide
        Mark Hillary added a comment -

        Just to add, the issue reported in SEC-773 does work for me. And I've never tried 2.0.0 only 2.0.1.

        Show
        Mark Hillary added a comment - Just to add, the issue reported in SEC-773 does work for me. And I've never tried 2.0.0 only 2.0.1.
        Hide
        Mark Hillary added a comment -

        I've updated my configuration to use Maven to ensure I am pulling the right dependencies in. Sorry its taken me a while, I've not used Maven before.

        Attached is my whole eclipse workspace for the test case in which I'm still seeing the null pointer. Not sure if it matters but I'm using JDK6 on windows XP.

        Show
        Mark Hillary added a comment - I've updated my configuration to use Maven to ensure I am pulling the right dependencies in. Sorry its taken me a while, I've not used Maven before. Attached is my whole eclipse workspace for the test case in which I'm still seeing the null pointer. Not sure if it matters but I'm using JDK6 on windows XP.
        Hide
        Luke Taylor added a comment - - edited

        I've moved all injection of UserDetailsService objects from a BeanFactoryPostProcessor to a BeanPostProcessor which is more appropriate in any case and should prevent any early instantiation problems. It prevents the NPE in your test, but there appears to be another error in the test (I think due to calling persist() for an entity on which the Id has already been set). However the problem of persistence annotations being missed should now be fixed. Could you try an up-to-date sapshot please and see if you still have any problems?

        Show
        Luke Taylor added a comment - - edited I've moved all injection of UserDetailsService objects from a BeanFactoryPostProcessor to a BeanPostProcessor which is more appropriate in any case and should prevent any early instantiation problems. It prevents the NPE in your test, but there appears to be another error in the test (I think due to calling persist() for an entity on which the Id has already been set). However the problem of persistence annotations being missed should now be fixed. Could you try an up-to-date sapshot please and see if you still have any problems?
        Hide
        Mark Hillary added a comment -

        Thanks Luke, that has fixed the problem for me. Cheers.

        Show
        Mark Hillary added a comment - Thanks Luke, that has fixed the problem for me. Cheers.
        Hide
        Luke Taylor added a comment -

        OK . Thanks for your feedback. Closing the issue.

        Show
        Luke Taylor added a comment - OK . Thanks for your feedback. Closing the issue.

          People

          • Assignee:
            Luke Taylor
            Reporter:
            Mark Hillary
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: