In the tool class, you want to get web Project port number and project name ,
Now the port number has been obtained , How to get the project name
Do not use request
The port number is obtained in this way
MBeanServer s = MBeanServerFactory.findMBeanServer(null).get(0);Set<ObjectName> ps = s.queryNames(new ObjectName("Catalina:type=Connector,*"), Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
do not know why idea Next springboot Project cannot get
eclipse Ordinary under maven The project can get
MBeanServer debuge I went in and found that there was a project name , But I don't know how to use Query Get .