SpringMVC 初始化2次

_落寞 2016-03-07 07:14:24
本人新手, 今天尝试搭建框架SpringMVC 整合 MyBatis , web.xml配置如下:
<servlet>
<servlet-name>spring3mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/conf/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring3mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
所有配置文件都放在applicationContext.xml中,系统跑起来之后, 发现SpringMVC初始化两次。
INFO - FrameworkServlet 'spring3mvc': initialization started
INFO - FrameworkServlet 'spring3mvc': initialization started
INFO - Refreshing WebApplicationContext for namespace 'spring3mvc-servlet': startup date [Mon Mar 07 19:15:51 CST 2016]; root of context hierarchy
INFO - Refreshing WebApplicationContext for namespace 'spring3mvc-servlet': startup date [Mon Mar 07 19:15:51 CST 2016]; root of context hierarchy
INFO - Loading XML bean definitions from ServletContext resource [/WEB-INF/conf/applicationContext.xml]
INFO - Loading XML bean definitions from ServletContext resource [/WEB-INF/conf/applicationContext.xml]
INFO - Loading properties file from ServletContext resource [/WEB-INF/conf/db.properties]
INFO - Loading properties file from ServletContext resource [/WEB-INF/conf/db.properties]
INFO - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory
INFO - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory
INFO - Hibernate Validator 4.1.0.Final
INFO - Hibernate Validator 4.1.0.Final
INFO - MLog clients using log4j logging.
INFO - MLog clients using log4j logging.
INFO - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
INFO - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
INFO - FrameworkServlet 'spring3mvc': initialization completed in 931 ms
INFO - FrameworkServlet 'spring3mvc': initialization completed in 931 ms
求各位大神给个解决的方法, 本人新手 才学习SpringMVC
...全文
164 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
街头小贩 2016-03-08
  • 打赏
  • 举报
回复
照你的理解我的日志输出也表示启动了两次?

2016-03-08 10:38:04  [ localhost-startStop-1:0 ] - [ INFO ]  Root WebApplicationContext: initialization started
2016-03-08 10:38:04  [ localhost-startStop-1:81 ] - [ INFO ]  Refreshing Root WebApplicationContext: startup date [Tue Mar 08 10:38:04 CST 2016]; root of context hierarchy
2016-03-08 10:38:04  [ localhost-startStop-1:120 ] - [ INFO ]  Loading XML bean definitions from class path resource [applicationContext.xml]
2016-03-08 10:38:04  [ localhost-startStop-1:300 ] - [ INFO ]  Loading XML bean definitions from class path resource [daospring.xml]
2016-03-08 10:38:04  [ localhost-startStop-1:461 ] - [ INFO ]  JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-03-08 10:38:04  [ localhost-startStop-1:542 ] - [ INFO ]  Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12e83bec: defining beans [org.springframework.aop.config.internalAutoProxyCreator,com.apobates.aspect.DaoExceptionAspect#0,com.apobates.event.aspect.ChannelOperationAspect#0,com.apobates.event.aspect.ChannelBatchOperationAspect#0,com.apobates.event.aspect.UserActiveAspect#0,userServiceImple,channelServiceImple,feedbackServiceImple,articleServiceImple,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,aO,operationDao,articleDao,userDao,channelDao,featureDao,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,jdbcTemplate,apoTransactionManager,transactionTemplate,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
2016-03-08 10:38:06  [ localhost-startStop-1:2477 ] - [ INFO ]  Root WebApplicationContext: initialization completed in 2477 ms
2016-03-08 10:38:08  [ localhost-startStop-1:0 ] - [ INFO ]  Root WebApplicationContext: initialization started
2016-03-08 10:38:08  [ localhost-startStop-1:79 ] - [ INFO ]  Refreshing Root WebApplicationContext: startup date [Tue Mar 08 10:38:08 CST 2016]; root of context hierarchy
2016-03-08 10:38:08  [ localhost-startStop-1:114 ] - [ INFO ]  Loading XML bean definitions from class path resource [applicationContext.xml]
2016-03-08 10:38:08  [ localhost-startStop-1:275 ] - [ INFO ]  Loading XML bean definitions from class path resource [daospring.xml]
2016-03-08 10:38:08  [ localhost-startStop-1:534 ] - [ INFO ]  JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-03-08 10:38:08  [ localhost-startStop-1:667 ] - [ INFO ]  Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@67c5c23a: defining beans [org.springframework.aop.config.internalAutoProxyCreator,com.apobates.aspect.DaoExceptionAspect#0,com.apobates.event.aspect.ChannelOperationAspect#0,com.apobates.event.aspect.ChannelBatchOperationAspect#0,com.apobates.event.aspect.UserActiveAspect#0,userServiceImple,channelServiceImple,feedbackServiceImple,articleServiceImple,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,aO,operationDao,articleDao,userDao,channelDao,featureDao,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,jdbcTemplate,apoTransactionManager,transactionTemplate,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
2016-03-08 10:38:11  [ localhost-startStop-1:3460 ] - [ INFO ]  Root WebApplicationContext: initialization completed in 3459 ms
街头小贩 2016-03-08
  • 打赏
  • 举报
回复
你用的是ssm组合:spring mvc+spring+MyBatis

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧