I have a project currently in TestContainers where its launching the default hapiproject/hapi container and mounting my jar and application.yaml. This works and the application starts up!
I'm having a few issues though, but I think I'm having some sort of larger HAPI misunderstanding.
1. I have setup the custom-bean-packages and it scans for @Configuration and @Component. but it does not pickup my custom test @Operation. I have to use @PostConstruct and restfulServer.registerProvier to get these to work
2. I'd like to provide a custom / route so I can put a nice page there. I finally got this to work by moving my hapi.fhir.tester.home.server_address to /fhir ... now my @Controller method with @GetMapping("/") is actually now invoking the controller method. Is the right way to do this?
3. However, it tries to use thymeleaf rendering and it will not look anywhere besides [/WEB-INF/templates/index.html] for those templates. How can i configure it to search the classpath? My customization.jar doesn't have WEB-INF.
Would appreciate any help on the above. Thanks!
My testcontainer startup code:
return new GenericContainer<>("hapiproject/hapi:v8.6.0-1")
//my rancher environment doesn't work unless i point it directly to the docker host on windows
.withEnv("DOCKER_HOST", "npipe:////./pipe/docker_engine")
//this contains the application.yaml file
.withFileSystemBind(Path.of("src/test/resources/hapi-config").toString(), "/app/config", BindMode.READ_ONLY)
//use our custom application.yaml mounted
.withEnv("SPRING_CONFIG_LOCATION", "file:/app/config/application.yaml")
//take the jar file from the dependent resource and run it
.withCopyToContainer(findJarFile(), "/app/extra-classes/cgt-fhir-customizations.jar")
.withExposedPorts(8080)
//print out the container logs
.withLogConsumer(outputFrame -> System.out.print(outputFrame.getUtf8String()))
.waitingFor(Wait.forHttp("/")
.forStatusCode(200)
.withStartupTimeout(Duration.ofMinutes(2))
);