java - why contextloader is trying to load WEB-INF/applicationContext.xml if using mvc-dispatcher-servlet.xml -
in gradle web project, want load mvc-dispatcher-servlet when starting tomcat deploying below exception in tomcat console:
web.xml :
<servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/api/*</url-pattern> </servlet-mapping> <!-- <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> -->
you can see have commented contextloaderlistener still loading applicationcontext.xml.
mvc-dispatcher-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd"> <context:component-scan base-package="<package-name>" /> <mvc:annotation-driven />
please some1 me out. followed document , stackoverflow didn't find solutions.
thanks in advance trying me!
note: using spring v.4.2.4 , tried 4.3.10 didn't work.
Comments
Post a Comment