• 依然↗纯白色
    2021-04-14
    小马哥,这个是不是由于Spring的Bean是单例的,这个类又是关联的Spring Bean才成为单例的,他本身并不是单例模式吧。因为并没有看到这个类使用懒汉、饿汉等模式创建

    作者回复: 这个不完全是 Spring Bean 单例造成的,而是的确是单例的实现

    共 3 条评论
    
  • 右耳朵猫咪
    2021-04-01
    小马哥,我想请教一下java web工程web.xml文件里的webAppRootKey是干嘛的?为什么tomcat部署多个应用,它只能指向一个应用,否则就会冲突。

    作者回复: org.springframework.web.util.WebAppRootListener 中的 API 上又写到: Some containers, e.g. Tomcat, do NOT keep system properties separate * per web app. You have to use unique "webAppRootKey" context-params per web app * then, to avoid clashes. Other containers like Resin do isolate each web app's * system properties: Here you can use the default key (i.e. no "webAppRootKey" * context-param at all) without worrying.

    
    