Results 1 to 3 of 3

Thread: Spring annotations and inheritance

  1. #1

    Default Spring annotations and inheritance

    Hi

    I have a question regarding the spring annotations scope. Answers may save me some experimenting time
    If I use for example @Service, @Controller or @PreAuthorize annotations on a class or a method that is inherited by another class, will that annotation apply to the subclass / overriding methods?
    What about the other way around, if i use an annotation on a subclass or an overriding method, will it be applying to the superclass / method? (i expect not).

    Yuval

  2. #2
    Join Date
    Aug 2005
    Posts
    10

    Default

    hi, i have the same question and find no clear answer from the web. Hope somebody or spring team can declare that.

  3. #3
    Join Date
    Oct 2010
    Posts
    18

    Default

    "me too"

    class Foo {
    @Transactional
    public void doSomething()
    { ... }
    }

    class Bar extends Foo{...}


    Is calling new Bar().doSomething() affected by the Transactional annotation in the super class??

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •