Results 1 to 7 of 7

Thread: Annotations vs XML Config

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Posts
    22

    Default Annotations vs XML Config

    I have a friend that is upset with annotations because he doesn't have a full view into all the beans, controllers, etc in one view. The annotations are littered throughout his project and can't figure out where everything is. I personally like annotations but everyone has their own style. I suggested to him that it would be easy with annotations to have them scanned to provide a report of how everything is wired together.

    Are there any tools that help give better visibility into spring projects by scanning for all the annotations and provide a report to see how everything is wired together?

  2. #2

    Default

    We use Springsource Tool Suite and spring explorer gives us the view of all beans. I am not sure whether you need this info for reporting or developer help. If it is for latter, I would definitely look at STS.

  3. #3
    Join Date
    Feb 2012
    Posts
    4

    Default

    Annotations vs XML Config and organized all matters in sequence so we will remind all perspectives
    of Oder and get a broad vision in any stage.
    Personal Trainer Overland Park
    Last edited by Raul John; Mar 2nd, 2012 at 11:40 PM.
    Raul John

  4. #4
    Join Date
    Feb 2012
    Posts
    5

    Default

    Since Java adopted annotations, I’ve heard a lot of discussion around whether to prefer annotations over external configuration files (often XML) and vice versa.

    I think the decision boils down to two criteria:

    1) Can annotations simplify the metadata?
    2) Can changes to the metadata break behavior in your application?

    If annotations do not reduce the amount of metadata that you have to provide (in most cases they do), then you shouldn’t use annotation.

    I think the more important thing to considered is whether a configuration change could break behavior or not. If not, then you can feel comfortable applying the change while the system is running in production. External config files are the best place for the metadata in this case because you don’t want to have to recompile your code to make the change.
    Last edited by hasselcloud; Mar 5th, 2012 at 01:53 PM.

  5. #5

    Default

    if you are going for configuration then it is better to follow some best practices to ensure better management of config files. http://www.deepakgaikwad.net/index.p...practices.html

  6. #6
    Join Date
    Mar 2012
    Posts
    14

    Default

    Annotation or XML is a big discussion which could go on and on because everyone has their own reason to why they prefer one over the other.

    As far as seeing a report is concerned on the various bean being used in an application, STS provides certain ways/views by which to see all the beans which are annotated. There are views such as "Beans Cross Reference", "@RequestMappings", which gives beans using annotations and methods in which @RequestMapping annotation is used.

Posting Permissions

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