Thứ Sáu, 20 tháng 11, 2015

Spring active profile

link: http://stackoverflow.com/a/8587739

use for active application-profileName.properties

<context-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>profileName</param-value>
</context-param>

Or

class SpringInitializer extends WebApplicationInitializer {

    void onStartup(ServletContext container) {
        AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
        rootContext.getEnvironment().setActiveProfiles("profileName");
        rootContext.register(SpringConfiguration.class);
        container.addListener(new ContextLoaderListener(rootContext));
    }
}

Or

Read at link: http://nixmash.com/java/a-spring-jpa-configuration-for-multiple-profiles/

Continue ...

- Comments

0 nhận xét:

Đăng nhận xét