How to alter/override Advertised server information in Spring boot Embedded Tomcat?

I’ve been digging how to do ‘tomcat hardening’ on embedded tomcat and I can’t find a way to alter these 3 catalina server info properties: server.info , server.built , server.number

Is there a way to alter those 3 properties in spring application.property file? Or by any other means?

Configuration below is a guide for hardening tomcat server specifically for ServerInfo.properties but NOT on embedded tomcat

Rationale:
Altering the server.info attribute may make it harder for attackers to determine which vulnerabilities affect the server platform.

Required Configuration:

Perform the following to alter the server platform string that gets displayed when clients connect to the tomcat server.

  1. Extract the ServerInfo.properties file from the catalina.jar file: $ cd CATALINA_HOME/lib jar xf catalina.jar org/apache/catalina/util/ServerInfo.properties
  2. Navigate to the util directory that was created cd org/apache/Catalina/util
  3. Open ServerInfo.properties in an editor
  4. Update the server.info attribute in the ServerInfo.properties file. server.info=
  5. Update the catalina.jar with the modified ServerInfo.properties file. $ jar uf catalina.jar org/apache/catalina/util/ServerInfo.properties

UPDATE:

I tried modifying the application fat jar by overwriting tomcat-embed-core-9.0.36 with modified ServerInfo.properties in it. But when I start the application via Java, I got this error:

Caused by: java.lang.IllegalStateException: Unable to open nested entry ‘BOOT-INF/lib/tomcat-embed-core-9.0.36.jar’. It has been compressed and nested jar files must be stored without compression. Please check the mechanism used to create your executable jar file at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:283) at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:265) at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:254) … 6 more