"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!
Edit: placing more emphasis on the software design aspect, and updating the API link to SpringV3.
Edit: placing more emphasis on the software design aspect, and updating the API link to SpringV3 As mentioned in other answers, this is not an ideal approach to Spring MVC, but nevertheless the controller will already be available for autowiring in your ApplicationContext. It's already a Bean in your ApplicationContext, so you can auto-wire it by type. There's no need to add an @Component annotation.
From the Spring API Docs: "This annotation serves as a specialization of @Component, allowing for implementation classes to be autodetected through classpath scanning. " http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/stereotype/Controller.html The same holds true for @Service. Although I've done it myself, I would not normally recommend this design approach.
If possible, refactor the required functionality into a separate bean, which can then be (auto-)wired into both the @Controller, and any other bean, as required. If, as you have commented, you are 'cornered' into this decision (as I was, by previous design choices), then so be it. HTH.
Not everything that's possible is also advisable. Using a web controller as dependency is an awful design flaw – Sean Patrick Floyd May 3 at 8:24 True, but I answered his question, recommended against it, and suggested an alternate approach. I think it's important to provide the answer, even if it's inadvisable on a design level.
– amir75 May 3 at 12:03 (the question was 'can' it, rather than 'should' it) – amir75 May 3 at 12:13 Okay, fair enough. Edit your answer and I'll remove the downvote (I can't unless you edit it). Nt: how about changing the 2.5.6 javadoc link to a current one – Sean Patrick Floyd May 3 at 13:04 1 @amir removed downvote as promised and added upvote :-) – Sean Patrick Floyd 5 May3 at 4:47.
It can but it shouldn't. A web controller should be an entry point, nothing else. Any reusable logic it performs should be in a dedicated service layer, not in the controller itself.
Thanks. Normally I would do that, but I just want to expose the same service as a DWR service and as a Rest service. I could write a controller that would then talk to the service, but it will have no logic.It will simply be a delagate to the service; not a big fan of hand writing delegates or proxies.
– pakman May 3 at 14:39 @pakman OK, how about putting the controller methods into an abstract class and creating two instances – Sean Patrick Floyd May 3 at 14:41.
No, sounds like it's doing too much. One or the other, not both. I don't know if it's possible (I doubt it), but I'm sure it's not advisable.
It is possible, but +1 for recommending against it – Sean Patrick Floyd May 3 at 8:20.
I think that you should hear more about patterns like Front Controller, MVC, DAO and Multitier architecture and so on.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.