Spring Boot获取profile值

Environment方式

1
2
3
4
@Autowired
Environment environment;

String profile = environment.getActiveProfiles()[0];