Have a SpringBoot application packaged as an EAR and deployed to a local TomEE 7 instance.
Once deployed, is hosted under a context path of TOMEE/my-app-api
A static index.html page in webapp folder is served correctly from TOMEE/my-app-api/index.html
I have a RestController
with a single GET endpoint mapped to /api/country
When I try and call the RestController
via TOMEE/my-app-api/api/country
I get a 404.
If I run the same app from the embedded Tomcat instance and call the RestController
via TOMCAT/api/country
I get a successful response.
Is there anything additional I need to configure in order for SpringBoot to be hosted under this context path?
EAR Gradle Task
apply plugin: 'ear'
version = '1.0.0-SNAPSHOT'
ear {
archiveName = 'git rev-parse --short HEAD'.execute().text.trim() + "-$version" + '-service.ear'
baseName = 'git rev-parse --short HEAD'.execute().text.trim()
version= "-$version" + '-service'
deploymentDescriptor {
displayName = 'Service API'
webModule('service-api.war', 'service-api')
}
}
dependencies{
deploy project(path: ':service-api', configuration: 'archives')
deploy project(path: ':service-data', configuration: 'archives')
deploy project(path: ':service-rules', configuration: 'archives')
}
Application class
@SpringBootApplication
public class ServiceApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ServiceApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(ServiceApplication.class, args);
}
}