简体   繁体   中英

How to Environment setup in spring boot

I want to setup environments in my spring boot application like production or development. I have to use different datasource according to environment. So what is the right way to do it in spring boot ?

You should have a look at profiles.

@Configuration
@Profile("production")
public class ProductionConfiguration {

    // ...

}

http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM