Results 1 to 2 of 2

Thread: how can i create custom annotation

  1. #1
    Join Date
    Dec 2007
    Location
    Kerala, India
    Posts
    66

    Thumbs up how can i create custom annotation

    hi friends how can i create a custom annotation

    such that i have annotation by using that i can mark a class and if the class is marked the class will behave in predefine way


    example

    i have tag @myinterceptor

    in class
    Code:
        @myinterceptor
    
        public  class test {
        
                //must act as an interceptor in my way
    
            }
    is it possible

    if it is possible plz give me how can i do it

    plz

  2. #2
    Join Date
    Sep 2004
    Location
    Manchester, NH
    Posts
    1,236

    Default

    Um, you needn't write your own annotation to implement interception with a custom class - read through the copious documentation on how to use Spring for AOP in various helpful ways.

    If this was just an example, and you want "something else" (besides interception) to happen as a result of your annotation, I don't think Spring has anything to really help you. You could consider looking at Guice, which offers a lot more flexibility around custom annotations.
    Peter Mularien | Blog
    Author, Spring Security 3 (Book) - Packt Publishing, Available in print and eBook form
    SCJP 5, Oracle DBA
    Any postings are my own opinion, and should not be attributed to my employer or clients.


Posting Permissions

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