Software⏱️ 2 min read📅 2026-05-31

How to Fix: Spring Boot: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

Missing EmbeddedServletContainerFactory bean prevents Spring Boot from starting the EmbeddedWebApplicationContext.

Quick Answer: Ensure that you have included the correct dependency in your project's pom.xml file for Tomcat or Jetty, and that you are using a compatible version of Spring Boot.

The 'Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean' error occurs when the Spring Boot application fails to create an embedded servlet container, which is necessary for web applications. This issue can be caused by a variety of factors, including outdated or incompatible dependencies.

🔍 Why This Happens

  • [Cause]

🚀 How to Resolve This Issue

Method 1: Using the Default EmbeddedServletContainerFactory

  1. Step 1: Add the following configuration to your application.properties or application.yml file:
@SpringBootApplication
import org.springframework.boot.web.embedded.servlet.ServletWebServerFactory;
import org.springframework.boot.web.embedded.servletServletWebServerFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Method 2: Using a Custom EmbeddedServletContainerFactory

  1. Step 1: Create a new class that extends the EmbeddedServletContainerFactory:
public class CustomEmbeddedServletContainerFactory extends EmbeddedServletContainerFactory,
{}
@Override
protected String getWebAppContextClass()
{
return

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions