Hello Tomcat users! I'm using an embedded Tomcat (9.0.54) with Spring Boot.
I have to execute some legacy code of an Java EE application which uses local EJBs an makes JNDI look for "java:app/foo/bar". Now I want to create an instance as Spring Bean an register it in the JNDI context. But Tomcat only registers objects in path "java:comp/env", if I use context.getNamingResources().addResource() by overwriting TomcatServletWebServerFactory.postProcessContext(ctx). Is there a supported solution for registering objects in "java:app"? I have a workaround with context.bind("java:app/foo/bar") during application startup but I need to do some dirty things to make the context writable. I think this is neither a good nor a long term solution. Any ideas or hints for a better approach? Thanks! Regards, Thomas