ensemble profil actif comme context.getEnvironment().setActiveProfiles("DEV");
qui peut être réalisé en utilisantComment définir des profils actifs dans la configuration java à base d'annotation Spring
public class SpringWebInitializer implements WebApplicationInitializer
{
public void onStartup(final ServletContext servletContext) throws ServletException
{
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.getEnvironment().setActiveProfiles("DEV")
}
}
Mais lors de l'extension AbstractAnnotationConfigDispatcherServletInitializer. comment pouvons-nous atteindre le réglage du profil actif?
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer
{
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] { WebConfig.class };
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
@Override
protected Class<?>[] getRootConfigClasses() {
return null;
}
}
merci pour la réponse @ActiveProfiles ("DEV") est dans les cas de test.is il ya une autre meilleure façon de la config java. –