Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!