Skip to content

Why is my WebApplicationInitializer not loaded #522

@dickerpulli

Description

@dickerpulli

I have a really simple Spring-Boot application and I wonder why my WebApplicationInitializer is not recognized by SpringServletContainerInitializer?

At application startup in console everythings looks fine, but there is no System.err-output from the Initializer. Also, if I set a breakpoint inside the onStartup method it is never reached.

Did I miss anything?

Thanks.

My classes:

package de.tbosch.web.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
package de.tbosch.web.springboot;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.springframework.web.WebApplicationInitializer;

public class Initializer implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        System.err.println("------------------------------------");
    }

}

Details: https://github.com/dickerpulli/playground/tree/master/web/spring-boot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions