热门标签 | HotTags
当前位置:  开发笔记 > Android > 正文

浅谈xml配置springprofiles的几个注意点

这篇文章主要介绍了浅谈xml配置springprofiles的几个注意点,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

先贴正确配置

<&#63;xml version="1.0" encoding="UTF-8"&#63;>


  
  

  
  
  
  
  
  

  
  
    
    
  

  
  
    
    
  

  
  
    
    
  

一. xml标签的xsd版本

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

<&#63;xml version="1.0" encoding="UTF-8"&#63;>

二. 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
  

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


推荐阅读
author-avatar
厚宝-Anzx_730
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有