Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

springboot配置xdiamond的多环境,如何实现? #38

Open
trey-tao opened this issue Aug 3, 2018 · 1 comment
Open

springboot配置xdiamond的多环境,如何实现? #38

trey-tao opened this issue Aug 3, 2018 · 1 comment

Comments

@trey-tao
Copy link

trey-tao commented Aug 3, 2018

spring-xdiamond配置文件的注入方式如下:

@SpringBootApplication()
@EnableScheduling
@ImportResource("classpath:spring-xdiamond-springboot.xml")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
我想将xdiamond.server.ip,port等参数通过application.properties配置,可以吗?
因为项目中由dev,product等等多套环境,每次上线都需要手动替换spring-xdiamond的配置IP,好麻烦啊!
求教!

@hengyunabc
Copy link
Owner

试下在 application.properties里配置一个 profile变量,然后:

@ImportResource("classpath:spring-xdiamond-springboot-${profile}.xml")

或者在 xml里配置 <profile> 标签。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants