使用oshi獲取系統信息

pox引入:

<!-- 獲取系統信息 -->
		<dependency>
			<groupId>com.github.oshi</groupId>
			<artifactId>oshi-core</artifactId>
			<version>3.13.2</version>
		</dependency>

實現方法:

@RequestMapping("/sysInfo")
	public String sysInfo(Model retmodel) {
		try {
			Server server = new Server();
			server.copyTo();
			retmodel.addAttribute("server", server);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "webmanage/sysinfo/versionInfo";
	}

工具類及實體類:
鏈接:https://pan.baidu.com/s/1f6LHxLzngCAkpahT-RX0Hg
提取碼:0rwr

效果:
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章