Toumi
Toumi

Reputation: 3155

why does spring boot war does not generate web.xml

In my spring boot app I have the following configuration to generate a war.

    apply plugin: 'war'

    war {
        baseName = 'sales_service_shared'
        version =  '0.0.1'
    }

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
...
}

Everything is working fine and the war is generated.

But the web.xml is missing. how can a war work without web.xml ?

Upvotes: 2

Views: 3443

Answers (1)

tmarwen
tmarwen

Reputation: 16374

In case you are deploying your application in a container supporting the latest JEE specs i.e. Servlet 3.0+ environments, the web.xml (aka deployment descriptor) is not mandatory.

Actually all the underlying servlet initializing goes programmatically through a org.springframework.web.WebApplicationInitializer implementation for a Spring applicationand similar mechanism.

Upvotes: 5

Related Questions