Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

239
Visualizações
Embedded mongo (flapdoodle) does not start in Spring Boot 1.5

I'm trying to upgrade from Spring Boot 1.4 to 1.5.2. As far as I can tell I've followed the update guidelines.

There are actually two issues, the main one which is to do with embedded mongo:

EmbeddedServletContainerFactory now has to be explicitly created

In the test config class I've had to add this:

@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
    factory.setPort(port);
    factory.setSessionTimeout(50, TimeUnit.MINUTES);
    return factory;
}

I did not have to do this before. I had to include it because when I run a test it gives me this error:

Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

Embedded Mongo will not start

Now I get this error:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'embeddedMongoServer' available

No idea where I should be adding this bean (and indeed why I should be adding it)

My current setup

I have multiple tests that extend BaseIT, which starts like this:

@RunWith(SpringRunner.class)
@DataMongoTest
@SpringBootTest(classes = {TestConfig.class, TestMongoConfig.class},, webEnvironment= SpringBootTest.WebEnvironment.DEFINED_PORT, value = "
{$server.port}")
@ActiveProfiles("test")
public abstract class BaseIT {...}

Mongo config class:

@Configuration
@EnableAutoConfiguration(exclude = { EmbeddedMongoAutoConfiguration.class })
@EnableMongoRepositories(basePackages = "...")
public class TestMongoConfig {
@Bean public MongoClient mongo(){...}
@Bean public MongodProcess mongodProcess(){...}
@Bean public MongodExecutable mongodExecutable(){...}
@Bean public IMongodConfig mongodConfig(){...}
@Bean public MongodStarter mongodStarter(){...}
}

Test config class:

@Configuration
@EnableAutoConfiguration(exclude = {EmbeddedMongoAutoConfiguration.class})
@ComponentScan(value = {...})
@EnableMongoRepositories(basePackages = {...)
@EnableWebMvc
public class TestConfig extends WebMvcConfigurerAdapter {...}
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda