先看看 maven 定义 profile 的写法 <!-- profiles --> <profiles> <profile> <activation> <activeByDefault>true</activeByDefault> </activation> <id>dev</id> <properties> <profile.env>dev</profile.env…
一. Spring Boot 简介 开箱即用的一站式 Java EE 解决方案 Spring 技术栈的大整合 核心问题 暂时无法回答 Spring Boot 和 SOA 有什么区别? Spring Boot 与 Spring Cloud 的区别与关系? SpringBoot 做了什么应对微服务的趋势? 其他问题 微服务是什么? SOA 是什么? Serveless 又是什么? Spring Cloud 是什么? 二. Maven 更多 Maven相关内容, 可参考 Maven 笔记 - 难以想象…
由于项目的需要, 今天给spirng boot项目添加了profile功能.再网上搜索了一圈,也没有找到满意的参考资料,其实配置并不难,就是没有一个one stop(一站式)讲解的地方,所以有了写这篇博客的想法.由于本人水平有限,文中任何错误和纰漏欢迎大家反馈.希望本文可以给你带来帮助. 本文实现的目标: 1 使用了maven的profile功能 2 使用了Spring Boot的profile功能 3 集成了1和2的功能 4 在eclipse中运行mvn工程,使用开发环境的profile. 5…
maven中配置profile节点: <project> .... <profiles> <profile> <!-- 生产环境 --> <id>prod</id> <properties> <profiles.active>prod</profiles.active> </properties> </profile> <profile> <!-- 本地开发…
Java & Maven & Spring & Spring Boot Spring Boot sb https://start.spring.io/ Spring 4 https://s3.amazonaws.com/baeldung.com/Building+a+REST+API+with+Spring.pdf Maven https://maven.apache.org/guides/index.html https://maven.apache.org/download.c…
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS等: 关于maven中央仓库 作为一个java程序员,对maven中央仓库https://mvnrepository.com/自然是非常熟悉的,毕竟咱们的应用依赖的jar大部分都来自此处,如果您想把自己开发的java库也托管在上面,让大家像使用Jackson.Spring那样轻松简单的使用您的jar…
                                  软件开发的一般流程为工程师开发 -> 测试 -> 上线,因此就涉及到三个不同的环境,开发环境.测试环境以及生产环境,通常这三个环境会有很多配置参数不同,例如数据源.文件路径.url等,如果每次上线一个新版本时都手动修改配置会十分繁琐,容易出错.spring 为我们提供了 profile 机制来解决这个问题. spring允许我们通过定义 profile 来将若干不同的 bean 定义组织起来,从而实现不同环境自动激活不同的 p…
本人免费整理了Java高级资料,涵盖了Java.Redis.MongoDB.MySQL.Zookeeper.Spring Cloud.Dubbo高并发分布式等教程,一共30G,需要自己领取.传送门:https://mp.weixin.qq.com/s/JzddfH-7yNudmkjT0IRL8Q 一个应用为了在不同的环境下工作,常常会有不同的配置,代码逻辑处理.Spring Boot 对此提供了简便的支持.关键词: @Profile.spring.profiles.active 目录 区分环境的…
Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 spring boot 连接Mysql spring boot配置druid连接池连接mysql spring boot集成mybatis(1) spring boot集成mybatis(2) – 使用pagehelper实现分页 spring boot集成mybatis(3) – mybatis ge…
一.原理: 1.实现ApplicationContextAware(当一个类实现了ApplicationContextAware这个接口之后,这个类就可以通过setApplicationContext方法获得ApplicationContext中的上下文),获取context.通过方法:context.getEnvironment().getActiveProfiles()获取激活的profile. 2.通过service中成员变量上的注解:@Value("${spring.profiles.a…