spring-激活profile(java)
来源:互联网 发布:淘宝网投诉电话转人工 编辑:程序博客网 时间:2024/06/06 02:49
设置激活profile
原文链接
作为servlet参数
package com.mkyong.servlet3;import javax.servlet.ServletContext;import javax.servlet.ServletException;public class MyWebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { //... @Override public void onStartup(ServletContext servletContext) throws ServletException { super.onStartup(servletContext); servletContext.setInitParameter("spring.profiles.active", "live"); //Set multiple active profile //servletContext.setInitParameter("spring.profiles.active", "dev, testdb"); }}
方式2
package com.mkyong.servlet3;import org.springframework.core.env.ConfigurableEnvironment;import org.springframework.web.context.WebApplicationContext;import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;public class MyWebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { //If the @Profile beans are loaded via root context @Override protected WebApplicationContext createRootApplicationContext() { WebApplicationContext context = (WebApplicationContext)super.createRootApplicationContext(); ((ConfigurableEnvironment)context.getEnvironment()).setActiveProfiles("live"); //Set multiple active profiles //((ConfigurableEnvironment)context.getEnvironment()) // .setActiveProfiles(new String[]{"live", "testdb"}); return context; }}
阅读全文
0 0
- spring-激活profile(java)
- spring profile激活处理
- Spring @Profile总是无法激活的解决办法
- 开发框架-Spring-Profile的配置、激活和读取
- spring 学习(二) Profile
- Spring profile
- spring profile
- spring profile
- 激活Maven profile同时打包
- Maven profile整合Spring profile
- Maven profile整合Spring profile
- Java for Web学习笔记(五八):Spring框架简介(7)bean的profile
- spring学习--spring profile
- 激活Maven profile的几种方式
- 激活maven profile的四种方式
- 激活Maven profile的几种方式
- 激活Maven profile的几种方式
- 激活maven特定参数profile的方法
- 知识点
- Android --- 常用的系统服务(一)
- NO.3 Mybatis.xml结构介绍
- Http状态码总结大全(200,404,500 etc)
- Win10 64位下用minGW编译64位FFMpeg
- spring-激活profile(java)
- SDNUOJ1099前缀判断(set)
- Unity Shader 学习笔记(4)Unity Shader内置变量、函数,Shader Model
- 习题6 6.3
- Java面试题全集(上)
- CSS 万能的 sticky-footer 写法
- LibreOJ103-子串查找
- 杭电ACM OJ 1005 Number Sequence 简单却重要的公式题 完美考察了递归思想
- Python2.7,PyQt4,实现键盘监听事件