TreeMind树图在线AI思维导图
当前位置:树图思维导图模板IT互联网互联网干货JavaSpring-Profile配置思维导图

JavaSpring-Profile配置思维导图

  收藏
  分享
免费下载
免费使用文件
U913167374 浏览量:42022-11-25 16:02:57
已被使用0次
查看详情JavaSpring-Profile配置思维导图

讲述了JavaSpring:通过配置修改不同开发环境。

树图思维导图提供 JavaSpring-Profile配置 在线思维导图免费制作,点击“编辑”按钮,可对 JavaSpring-Profile配置  进行在线思维导图编辑,本思维导图属于思维导图模板主题,文件编号是:55f865667a20c0439f1cd7b81a3f18d0

思维导图大纲

JavaSpring-Profile配置思维导图模板大纲

(1)示例Bean

package com.wisely.highlight_spring4.ch2.profile; public class DemoBean { private String content; public DemoBean(String content) { super(); this.content = content; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } }

(2)Profile配置

package com.wisely.highlight_spring4.ch2.profile; @Configuration public class ProfileConfig { @Bean @Profile("dev") //1 先将活动的Profile设置为prod public DemoBean devDemoBean() { return new DemoBean("from development profile"); } @Bean @Profile("prod") //2 后置注册Bean配置类,不然会报Bean未定义的错误。 public DemoBean prodDemoBean() { return new DemoBean("from production profile"); } }

(3)运行

public class Main { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.getEnvironment().setActiveProfiles("prod"); //1 context.register(ProfileConfig.class);//2 context.refresh(); //3 刷新容器 DemoBean demoBean = context.getBean(DemoBean.class); System.out.println(demoBean.getContent()); context.close(); } }

输出

1.from production profile

2.from development profile

修改为context.getEnvironment().setActiveProfiles("dev")

相关思维导图模板

配置网络和firewall防火墙思维导图

树图思维导图提供 配置网络和firewall防火墙 在线思维导图免费制作,点击“编辑”按钮,可对 配置网络和firewall防火墙  进行在线思维导图编辑,本思维导图属于思维导图模板主题,文件编号是:a4deb8c2436c6e677fbc29992596caee

软件配置管理思维导图

树图思维导图提供 软件配置管理 在线思维导图免费制作,点击“编辑”按钮,可对 软件配置管理  进行在线思维导图编辑,本思维导图属于思维导图模板主题,文件编号是:efd0cce8a9ebf9f9735b4f16be72cd77