I would like to print (as debug info) the type and version of the App Server my webapp is running on.
With a little search so far I was able to come up with this via the org.springframework.core.env.Environment
:
this.environment.getProperty("java.naming.factory.initial")
However it just says "org.apache.naming.java.javaURLContextFactory"
and not like "Apache Tomcat/8.0.33"
which I would like to see.
Use ServletContext.getServerInfo()
Btw: In Spring you can inject ServletContext
@Service
public class ServerLoggingService() {
@Autowired
private ServletContext servletContext;
@PostConstruct
public void printServer() {
System.out.println("Server Version: " + this.servletContext.getServerInfo());
}
}