We have a SpringBoot application which is deployed as a war file. In the main ApplicationClass we have scanBasePackages with a path expression different from the package of the ApplicationClass.
@SpringBootApplication(scanBasePackages= { "com.test.cmn" })
@EnableCaching
public class Application extends SpringBootServletInitializer{
public static void main( String[] args ){
SpringApplication.run( Application.class, args );
}
/**
* @see org.springframework.boot.web.support.SpringBootServletInitializer#onStartup(javax.servlet.ServletContext)
* @param servletContext
* @throws ServletException
*/
@Override
public void onStartup( ServletContext servletContext ) throws ServletException{
//WebEnviromentConfiguration.setActiveProfile(servletContext);
servletContext.setInitParameter( "spring.profiles.active", "dev" );
super.onStartup( servletContext );
}
@Override
protected SpringApplicationBuilder configure( SpringApplicationBuilder builder ){
return builder.sources( Application.class );
}
}
The base package scanning is working for the Beans that are there in the WEB-INF/classes folder. But the beans which are there in the jar file is not detected. But we are able to see those beans in the application class path (by loading the classes explicitly).
Is there something else that we need to do to auto detect those beans?