root-wyj / springboot_im

使用springboot + nettysocketio开发的一个简易卡牌游戏。主要想了解游戏服务端开发流程,基本逻辑等相关知识和长连接。
107 stars 47 forks source link

方法比较 #5

Open zjqwll opened 6 years ago

zjqwll commented 6 years ago

@Component public class ImProperties {

public static String WEBSOCKET_SERVER_URL;

@PostConstruct
private void init() {
    WEBSOCKET_SERVER_URL = websocketServerUrl;
}

@Value(value = "${netty.socketio.server.host}")
private String websocketServerUrl;

}

我想问下用静态方法这样写和直接用get,set这么写有什么好处?

root-wyj commented 6 years ago

这样写 就是为了方便使用配置文件 配置该属性