I solved my problem!
Turns out this has nothing to do with the boot order or the <mvc:annotation-driven/> declaration.
I tried deploying my web application to another Tomcat, and, to my surprise, there is a stack trace in the localhost log. I had a hint of trial and error that conflict with <aop:config/> . But what is the specific conflict?
Then I saw this error in the log file:
java.lang.ClassCastException: org.aspectj.weaver.ResolvedType$Array cannot be cast to org.aspectj.weaver.ReferenceType
So we have an exception. I searched for that exact error above and found this: Spring 3: adding reasons to ClassCastException
A thread starter appears and I have the exact same problem. So I downloaded aspectj-1.6.10.jar, but I was still missing from the class. Then it turns out that it should be aspectjweaver-1.6.9
I still used a very old gambling file. He had no version in his name. The problem is solved. Case is closed.
By the way, as a bonus, I manually deployed the <mvc:annotation-driven/> element to its equivalent xml declaration:
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="order" value="0" /> </bean> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="webBindingInitializer"> <bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer"> <property name="validator" ref="validator" /> </bean> </property> <property name="messageConverters"> <list> <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" /> <bean class="org.springframework.http.converter.StringHttpMessageConverter" /> <bean class="org.springframework.http.converter.FormHttpMessageConverter" /> <bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter" /> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> </list> </property> </bean> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /> <bean id="conversion-service" class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />
They are exactly the same when you declare <mvc:annotation-driven/> based on what I explored.
Thanks to everyone who helped me.
chris
source share