My environment is as the following:-
From Docker `payara/micro:latest`
- Payara Version: Payara Micro 5.184 #badassmicrofish (build 89)- Edition: Micro- JDK Version:
openjdk version "1.8.0_181"OpenJDK Runtime Environment (IcedTea 3.9.0) (Alpine 8.181.13-r0)OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
- Operating System:
NAME="Alpine Linux"ID=alpineVERSION_ID=3.8.1PRETTY_NAME="Alpine Linux v3.8"
FROM payara/micro:latestARG WAR_FILECOPY target/lib /opt/libCOPY target/${WAR_FILE} $DEPLOY_DIR
service-a: image: my/service-a:1.0.0-SNAPSHOT restart: always entrypoint: - java - -jar - /opt/payara/payara-micro.jar - --deploymentDir - /opt/payara/deployments - --addLibs - /opt/lib/
my-project
+-- util
| +-- some-classes
| |
| `-- META-INF
| `--beans.xml
`-- service-a
`--WEB-INF
+-- classes
| `-- some-classes
+--lib
| `--util.jar
`-- beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee version="2.0" bean-discovery-mode="all">
</beans>
@ApplicationScoped
public class MyUtil {
public String say(final String name) {
return "Hello " + name;
}
}
@Path("myResource")@ApplicationScopedpublic class MyResource {
@Inject
private MyUtil myUtil;
@GET
@Path("/{name}")
public Response hello(@PathParam("name") final String name) {
String message = this.myUtil.say(name);
return Response.ok(message).build();
}
}