wg-basic/basic-properties/src/main/java/ink/wgink/properties/ServerProperties.java

138 lines
3.3 KiB
Java
Raw Normal View History

2021-04-09 20:19:31 +08:00
package ink.wgink.properties;
2021-02-25 23:23:47 +08:00
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: ServerProperties
* @Description: 服务配置
2021-02-25 23:23:47 +08:00
* @Author: WangGeng
* @Date: 2019/9/3 10:14 上午
* @Version: 1.0
**/
@Component
@ConfigurationProperties(prefix = "server")
2021-04-09 20:19:31 +08:00
public class ServerProperties {
2021-02-25 23:23:47 +08:00
2021-02-28 18:22:25 +08:00
/**
* 服务端口
*/
2021-02-25 23:23:47 +08:00
private Integer port;
2021-02-28 18:22:25 +08:00
/**
* 访问地址
*/
2021-02-25 23:23:47 +08:00
private String url;
2021-02-28 18:22:25 +08:00
/**
* WebSocket 地址
*/
2021-02-25 23:23:47 +08:00
private String ws;
2021-02-28 18:22:25 +08:00
/**
* 系统主标题
*/
2021-02-27 22:07:08 +08:00
private String systemTitle;
2021-02-28 18:22:25 +08:00
/**
* 系统副标题
*/
2021-02-27 22:07:08 +08:00
private String systemSubTitle;
2021-02-28 18:22:25 +08:00
/**
* 默认 index 页面
*/
private String defaultIndexPage;
/**
* 默认 home 页面
*/
private String defaultHomePage;
/**
* 初始化
*/
private ServerInitProperties init;
2021-02-25 23:23:47 +08:00
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getUrl() {
return url == null ? "" : url.trim();
}
public void setUrl(String url) {
this.url = url;
}
public String getWs() {
2021-02-27 22:07:08 +08:00
return ws == null ? "" : ws.trim();
2021-02-25 23:23:47 +08:00
}
public void setWs(String ws) {
this.ws = ws;
}
2021-02-27 22:07:08 +08:00
public String getSystemTitle() {
2021-02-28 12:12:04 +08:00
return systemTitle == null ? "统一用户管理系统" : systemTitle.trim();
2021-02-25 23:23:47 +08:00
}
2021-02-27 22:07:08 +08:00
public void setSystemTitle(String systemTitle) {
this.systemTitle = systemTitle;
}
public String getSystemSubTitle() {
2021-02-28 12:12:04 +08:00
return systemSubTitle == null ? "山西腾狮科技" : systemSubTitle.trim();
2021-02-27 22:07:08 +08:00
}
public void setSystemSubTitle(String systemSubTitle) {
this.systemSubTitle = systemSubTitle;
2021-02-25 23:23:47 +08:00
}
2021-02-28 18:22:25 +08:00
public String getDefaultIndexPage() {
return defaultIndexPage == null ? "" : defaultIndexPage;
2021-02-25 23:23:47 +08:00
}
2021-02-28 18:22:25 +08:00
public void setDefaultIndexPage(String defaultIndexPage) {
this.defaultIndexPage = defaultIndexPage;
2021-02-25 23:23:47 +08:00
}
2021-02-28 18:22:25 +08:00
public String getDefaultHomePage() {
return defaultHomePage == null ? "" : defaultHomePage.trim();
2021-02-27 22:07:08 +08:00
}
2021-02-28 18:22:25 +08:00
public void setDefaultHomePage(String defaultHomePage) {
this.defaultHomePage = defaultHomePage;
2021-02-25 23:23:47 +08:00
}
public ServerInitProperties getInit() {
return init;
}
public void setInit(ServerInitProperties init) {
this.init = init;
}
2021-02-27 22:07:08 +08:00
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"port\":")
.append(port);
sb.append(",\"url\":\"")
.append(url).append('\"');
sb.append(",\"ws\":\"")
.append(ws).append('\"');
sb.append(",\"systemTitle\":\"")
.append(systemTitle).append('\"');
sb.append(",\"systemSubTitle\":\"")
.append(systemSubTitle).append('\"');
2021-02-28 18:22:25 +08:00
sb.append(",\"defaultIndexPage\":\"")
.append(defaultIndexPage).append('\"');
sb.append(",\"defaultHomePage\":\"")
.append(defaultHomePage).append('\"');
2021-02-27 22:07:08 +08:00
sb.append('}');
return sb.toString();
2021-02-25 23:23:47 +08:00
}
}