springboot_im icon indicating copy to clipboard operation
springboot_im copied to clipboard

方法比较

Open zjqwll opened this issue 7 years ago • 1 comments

@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这么写有什么好处?

zjqwll avatar Mar 23 '18 07:03 zjqwll

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

root-wyj avatar Apr 20 '18 10:04 root-wyj