Reputation: 3
I've downloaded Spring Roo 2.0.0 RC1 along with Spring Tools Suite 3.9 on OS X.
I created an empty project then run the following command to import the PetClinic sample :
script --file clinic.roo
The import as well as the Maven dependencies install worked as expected. But when I run the application on the server (stock Pivotal tc Server Developer Edition v3.2), I get a 404 error !
I put a debug breakpoint on the annotated @SpringBootApplication
main class in which we have the main and nothing caught.
Question : how can I run the pet clinic sample ? Why the application doesn't boot ?
Regards.
Upvotes: 0
Views: 150
Reputation: 15070
According to the Spring documentation : In order to start it correctly on a Java EE server, you have to extend SpringBootServletInitializer
.
Please, make sure that this class comes from the org.springframework.boot.web.support
package and not from the org.springframework.boot.context.web
package.
After the extends
you have to override the configure
method just like this :
@SpringBootApplication
public class PetClinicApplication extends SpringBootServletInitializer{
private static Class<PetClinicApplication> applicationClass = PetClinicApplication.class;
/**
* TODO Auto-generated method documentation
*
* @param args
*/
public static void main(String[] args) {
SpringApplication.run(PetClinicApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(applicationClass);
}
}
Explanation (from the same link above):
This new base class - SpringBootServletInitializer - taps into a Servlet 3 style Java configuration API which lets you describe in code what you could only describe in web.xml before.
Upvotes: 3