栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

浅谈xml配置spring profiles的几个注意点

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

浅谈xml配置spring profiles的几个注意点

先贴正确配置




  
  

  
  
  
  
  
  

  
  
    
    
  

  
  
    
    
  

  
  
    
    
  

一. xml标签的xsd版本

spring-beans.xsd 文件不要指定版本,也可以使用高版本(起码是3.1),原因是 spring profile 是3.1版本开始的。


二. dispatcherServlet文件配置

web.xml中配置了 DispatcherServlet 的 contextConfigLocation,需要在 spring-dispatch.xml 添加 spring profile 的配置,配置项同上。

  
  
    spring.profiles.active
    prd
  

  
  
    contextConfigLocation
    
      classpath:config/spring/spring-context.xml
      classpath:config/spring/spring-security.xml
    
  

  ......

  
  
    dispatcher
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      
 classpath:config/spring/spring-hessian-server.xml
 classpath:config/spring/spring-dispatch.xml
 classpath:config/spring/spring-security.xml
      
    
    1
  

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/137530.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号