Announcement Announcement Module
No announcement yet.
why deprecated the class "BaseCommandController"??? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • why deprecated the class "BaseCommandController"???

    hello everyone!

    Before I used the Spring2.0 to development Spring Web MVC,it's well.

    Today,When I use the Spring MVC whit Spring3.0.I found the class BaseCommandController,AbstractCommandController,Si mpleFormController and AbstractFormController all marked Deprecated

    I don't know why.

    who can tell me why Spring Deprecated these,what should I use to developement the Spring Web MVC.

    Thanks in advance.

  • #2
    How about reading the release notes.

    Controller is deprecated in favor of @Controller.


    • #3
      why fav the annotation @Controller

      oh thank you very much.
      only this ?no any reason?

      and I want konow ,why spring fav the annotation @Controller?

      I'm a chinese,my English is bad.

      thanks in advance.


      • #4
        Basically Controller is quite rigid not really flexible, @Controller is much simpler and more flexible.


        • #5
          thank you for your answer

          Thank you patience and enthusiasm's reply.Please allow my sincere gratitude to you. you are sweet.

          the mean is "Spring favor use annotation,Before I think the annotation is Inefficient,so i rarely used the annotation,But now I think spring is used Reflection,so we can use the annotation"

          Did I get that right?

          I'm hoping you'll show me what to do.

          Thanks in advance.


          • #6
            Well they don't really favor annotations, it depends on who you talk to . I still like xml but I can see the real value add for annotations in this particulair case. It makes your controllers much simpler, they become basically just the glue layer between the web and your backend services.

            For the remainder of the configuration I still tend to use xml, because well I like my xml configuration. But as I said that is just IMHO.


            • #7
              Ah,thanks .

              You mean Spring don't really favor annotations,But they deprecated the Controller Class,and tell people to use the annotaions.

              This is a special case,only beacause has little effect and simpler.

              Maybe this is the real intention of spring?

              I like to talk with you.Thank you very much.


              • #8
                The Controller base classes were one of the few areas where adopting Spring caused you to subclass a Spring framework class. The annotation, while still coupling an individual source file to interpretation by Spring, is less intrusive than subclassing the Spring class. There are also a bunch of new annotations for building Spring MVC application in a RESTful manner.


                • #9
                  As you say.

                  Use the annotation is because it's less intrusive than subclassing.

                  I seem understander the mean.

                  thank you


                  • #10
                    Spring isn't about favoring one approach (annotaions or xml) over another, spring is in general about choise (although the web area might be a bit of a corner case here) although you can still configure the annotation controllers (partial mapping, dependency injection) in xml instead of annotations.


                    • #11
                      This way.I also do not quite understand.

                      Can you give me a small demo,like how should I use the Controller in sping.

                      Thank you very much.


                      • #12
                        Originally posted by in.think View Post
                        This way.I also do not quite understand.

                        Can you give me a small demo,like how should I use the Controller in sping.

                        Thank you very much.
                        Download the latest version of Spring with docs (goto and click on Downloads. You're looking for a file called (this is the latest version at time of writing).

                        Download and extract this file to your local disk. Look in the folder called "docs/spring-framework-reference". There's information contained there on how to create a Controller in Spring using annotations.

                        Good luck,



                        • #13
                          OK.Thank you .

                          My mean is how to rational and properly use of SpringMVC's controller.

                          Like the spring demo is the best way?

                          Itís means :Spring favor the annotation,because it's less intrusive than subclassing.


                          • #14
                            I've been using/learning Spring since September. At that time I didn't know about the annotated way. I didn't even know what an annotation was. I started using Spring 2.5.6.

                            The tutorials I stumbled upon showed Spring MVC being used via inheritance. I think most of the examples on the web are probably showing the subclassing way.

                            Only when I upgraded to Spring 3 did I notice the deprecated controller classes and start looking at annotated controllers.

                            I like them. They are neater and I've just cut out a swathe of XML configuration. I like that you can just write methods to accept whatever parameters you wish. You are not constrained to HttpServletRequest and HttpServletResponse and the task of extracting what you want from these objects. I've found other benefits too.

                            Back to your question about how to learn: My advice (assuming you are starting a project from scratch) is to ignore the subclassing and just focus on the annotated controllers.

                            Where to go to learn:
                            • Look at that document (Spring Framework Reference) I pointed you at in the previous post.
                            • For Spring 2.x there was a really great document showing how to create a Spring MVC application step-by-step. According to this blog comment there's one currently being created for Spring 3.x. That will help enormously as you'll see from the ground up how to create annotated controllers.
                            • Read more blog posts like the one mentioned above.
                            • Get the source code to the Spring PetClinic application. PetClinic can be used as a reference to see how to do things in Spring. It has many controllers, persistence, themes, etc. For more information, look here.
                            • Most importantly, just try to write something and when you get a problem do searches on this forum, or Google, or ask on this forum.


                            • #15
                              thank you again!

                              When I use the spring 3.0 I found the I want to know why.

                              I would like to thank you all for your suggestions, ideas.