美文网首页
SpingMvc学习笔记

SpingMvc学习笔记

作者: sunny4handsome | 来源:发表于2017-12-10 15:59 被阅读0次

本文主要记录一些比较的零散的东西

  <servlet>
      <servlet-name>springMVC</servlet-name>
      <servlet-class>
         org.springframework.web.servlet.DispatcherServlet
      </servlet-class>
      <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:springMVC-servlet.xml</param-value>
     </init-param>
     <load-on-startup>1</load-on-startup>
   </servlet>

这里的classpath路径指的是EB-INF/classes的目录


  • 通过spring注解创建的Bean,默认是单例模式
    如果需要多例模式用如下方式:
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class HelloService {
}
或者
@Scope("prototype")
public class HelloService {
}

相关文章

网友评论

      本文标题:SpingMvc学习笔记

      本文链接:https://www.haomeiwen.com/subject/hfrvixtx.html