Reputation: 1385
I am porting one of my applications from the Spring tool suit IDE to pure Eclipse Java EE IDE. In this process, I'm renaming some packages and changed to Maven based. Then all the controllers don't work anymore.
I think the annotation controller discovery seems broken. no mapping url is registared with Spring.
Does anyone knows what the problem is?
I collect the old log from my STS(working), it works and likes like
> 2013-04-21 22:43:05,622 [Thread-1] DEBUG
> org.springframework.beans.factory.support.DefaultListableBeanFactory -
> Finished creating instance of bean
> 'org.springframework.web.servlet.handler.MappedInterceptor#2'
> 2013-04-21 22:43:05,623 [Thread-1] DEBUG
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
> - Looking for request mappings in application context: WebApplicationContext for namespace 'HelloSpringroo2-servlet': startup
> date [Sun Apr 21 22:43:05 EDT 2013]; parent: Root
> WebApplicationContext 2013-04-21 22:43:05,653 [Thread-1] INFO
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
> - Mapped "{[/account/create],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}"
> onto public java.lang.String
> com.hellospringroo.controllers.AccountController.createAccountActionDisplay(org.springframework.ui.Model)
> 2013-04-21 22:43:05,653 [Thread-1] INFO
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
> - Mapped "{[/account/view/{account_Id}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}"
> onto public java.lang.String
> com.hellospringroo.controllers.AccountController.viewAccountActionDisplay(int,org.springframework.ui.Model)
> throws java.lang.Exception
Then I collect the log from Eclipse(Problem one)
> 2013-04-21 22:48:04,900 [http-bio-8080-exec-3] DEBUG
> org.springframework.web.servlet.DispatcherServlet - DispatcherServlet
> with name 'Education' processing GET request for [/Education/]
> 2013-04-21 22:48:04,901 [http-bio-8080-exec-3] DEBUG
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
> - Looking up handler method for path / 2013-04-21 22:48:04,901 [http-bio-8080-exec-3] DEBUG
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
> - Did not find handler method for [/] 2013-04-21 22:48:04,904 [http-bio-8080-exec-3] DEBUG
> org.springframework.web.servlet.handler.SimpleUrlHandlerMapping -
> Mapping [/] to HandlerExecutionChain with handler
> [org.springframework.web.servlet.mvc.ParameterizableViewController@54bbb2d0]
> and 1 interceptor 2013-04-21 22:48:04,905 [http-bio-8080-exec-3] DEBUG
> org.springframework.web.servlet.DispatcherServlet - Last-Modified
> value for [/Education/] is: -1 2013-04-21 22:48:04,914
> [http-bio-8080-exec-3] DEBUG
> org.springframework.beans.factory.support.DefaultListableBeanFactory -
> Invoking afterPropertiesSet() on bean with name 'index'
Upvotes: 2
Views: 8814
Reputation: 5615
Have you by any chance changed the version of Spring jars from 3.0 to 3.2 or from 3.2.M1 from 3.2.2 etc?
I had similar problem (not exact), but this is what worked for me.
Old version had @Controller("\abc")
with handler Method @RequestMapping("\pqr")
. the urls which were handled were \abc\pqr
with new version that did not worked I had to change it to
@Controller @RequestMapping ("\abc")
and then handler method mapping same as above.
Or use complete url mappings on handler method instead of at controller level for example @RequestMapping("\abc\pqr")
on method level.
Upvotes: 0
Reputation: 2769
your:
<context:component-scan base-package="old.package.name" />
should now be
<context:component-scan base-package="new.package.name" />
Upvotes: 2