KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a problem with my Spring application where my @Service classes are being created twice when the application starts. I know this is a problem with my configuration, as I've experienced it before, but what exactly am I doing wrong? Is there anything fundamentally wrong with the way I've laid out my config, below? (I have omitted everything I deem to be irrelevant) web.xml: <servlet> <servlet-name>myapp</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>myapp</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/myapp-config.xml /WEB-INF/myapp-security.xml /WEB-INF/myapp-mvc.xml </param-value> </context-param> <listener> <listener-class>com.myapp.servlet.MyAppContextListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> myapp-servlet.xml <context:component-scan base-package="com.myapp" annotation-config="true" /> <mvc:annotation-driven /> myapp-config.xml <context:component-scan base-package="com.myapp" annotation-config="true" /> <context:annotation-config />
Tags (comma-separated)
Save Edits
Cancel