mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-16 13:30:43 +08:00
Configuration
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
package org.maxkey.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 全局应用程序配置
|
||||
@@ -21,38 +22,52 @@ import org.slf4j.LoggerFactory;
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@PropertySource("classpath:/config/applicationConfig.properties")
|
||||
public class ApplicationConfig {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(ApplicationConfig.class);
|
||||
@Autowired
|
||||
DataSoruceConfig dataSoruceConfig;
|
||||
|
||||
@Autowired
|
||||
EmailConfig emailConfig;
|
||||
|
||||
@Autowired
|
||||
CharacterEncodingConfig characterEncodingConfig;
|
||||
|
||||
|
||||
@Autowired
|
||||
LoginConfig loginConfig;
|
||||
|
||||
@Value("${config.server.domain}")
|
||||
String domainName;
|
||||
|
||||
@Value("${config.server.subdomain}")
|
||||
String subDomainName;
|
||||
|
||||
@Value("${config.server.name}")
|
||||
String serverName;
|
||||
|
||||
@Value("${config.server.prefix.uri}")
|
||||
String serverPrefix;
|
||||
|
||||
@Value("${config.server.default.uri}")
|
||||
String defaultUri;
|
||||
|
||||
@Value("${config.server.manage.uri}")
|
||||
String manageUri;
|
||||
|
||||
/*
|
||||
//is enable whiteList for ipAddress filter
|
||||
boolean whiteList;
|
||||
|
||||
//All user have permission Access URL
|
||||
public ConcurrentHashMap<String,String> anonymousAccessUrls;
|
||||
*/
|
||||
|
||||
String manageUri;
|
||||
|
||||
|
||||
|
||||
public ApplicationConfig() {
|
||||
super();
|
||||
|
||||
anonymousAccessUrls=new ConcurrentHashMap<String,String>();
|
||||
/*anonymousAccessUrls=new ConcurrentHashMap<String,String>();
|
||||
anonymousAccessUrls.put("/index/", "/index/");
|
||||
anonymousAccessUrls.put("/index/top","/index/top/");
|
||||
anonymousAccessUrls.put("/index/left/","/index/left/");
|
||||
@@ -68,6 +83,7 @@ public class ApplicationConfig {
|
||||
anonymousAccessUrls.put("/approles/appRolesGrid/","/approles/appRolesGrid/");
|
||||
|
||||
_logger.debug("Anonymous Access Urls : \n"+anonymousAccessUrls);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -147,7 +163,7 @@ public class ApplicationConfig {
|
||||
public void setSubDomainName(String subDomainName) {
|
||||
this.subDomainName = subDomainName;
|
||||
}
|
||||
|
||||
/*
|
||||
public ConcurrentHashMap<String, String> getAnonymousAccessUrls() {
|
||||
return anonymousAccessUrls;
|
||||
}
|
||||
@@ -158,7 +174,7 @@ public class ApplicationConfig {
|
||||
this.anonymousAccessUrls.put(anonymousAccessUrl,anonymousAccessUrl);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* @return the emailConfig
|
||||
*/
|
||||
@@ -182,12 +198,21 @@ public class ApplicationConfig {
|
||||
this.manageUri = manageUri;
|
||||
}
|
||||
|
||||
public String getDefaultUri() {
|
||||
return defaultUri;
|
||||
}
|
||||
|
||||
public void setDefaultUri(String defaultUri) {
|
||||
this.defaultUri = defaultUri;
|
||||
}
|
||||
|
||||
/*
|
||||
public boolean isWhiteList() {
|
||||
return whiteList;
|
||||
}
|
||||
|
||||
public void setWhiteList(boolean whiteList) {
|
||||
this.whiteList = whiteList;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -5,26 +5,35 @@ package org.maxkey.config;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
/**
|
||||
* 字符集转换及转换配置
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@PropertySource("classpath:/config/applicationConfig.properties")
|
||||
public class CharacterEncodingConfig {
|
||||
|
||||
/**
|
||||
* 源字符集
|
||||
*/
|
||||
@Value("${config.characterencoding.charset.from}")
|
||||
String fromCharSet;
|
||||
|
||||
/**
|
||||
* 目标字符集
|
||||
*/
|
||||
@Value("${config.characterencoding.charset.to}")
|
||||
String toCharSet;
|
||||
|
||||
/**
|
||||
* 转换标志
|
||||
*/
|
||||
@Value("${config.characterencoding.encoding}")
|
||||
boolean encoding = false;
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@ package org.maxkey.config;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.mybatis.jpa.dialect.Dialect;
|
||||
import org.maxkey.crypto.Base64Utils;
|
||||
import org.maxkey.crypto.password.PasswordReciprocal;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
/**
|
||||
* 数据源配置
|
||||
@@ -20,32 +22,40 @@ import org.maxkey.crypto.password.PasswordReciprocal;
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@PropertySource("classpath:/config/applicationConfig.properties")
|
||||
public class DataSoruceConfig {
|
||||
|
||||
/**
|
||||
* 数据库类型
|
||||
*/
|
||||
@Value("${config.datasource.database:mysql}")
|
||||
String database;
|
||||
/**
|
||||
* jdbc驱动类
|
||||
*/
|
||||
@Value("${config.datasource.driverclass:com.mysql.jdbc.Driver}")
|
||||
String driverClass;
|
||||
/**
|
||||
* jdbc连接地址
|
||||
*/
|
||||
@Value("${config.datasource.url:jdbc:mysql://localhost/maxkey?autoReconnect=true&characterEncoding=UTF-8}")
|
||||
String url;
|
||||
/**
|
||||
* 数据库用户名
|
||||
*/
|
||||
@Value("${config.datasource.username:root}")
|
||||
String username;
|
||||
/**
|
||||
* 数据库密码
|
||||
*/
|
||||
@Value("${config.datasource.password:maxkey}")
|
||||
String password;
|
||||
|
||||
/**
|
||||
* 数据库密码是否加密
|
||||
*/
|
||||
@Value("${config.datasource.password.encrypt}")
|
||||
boolean encrypt=false;
|
||||
|
||||
/**
|
||||
@@ -107,7 +117,6 @@ public class DataSoruceConfig {
|
||||
* @param database the database to set
|
||||
*/
|
||||
public void setDatabase(String database) {
|
||||
this.dialect=Dialect.getDialectMap().get(database);
|
||||
this.database = database;
|
||||
|
||||
}
|
||||
@@ -143,6 +152,9 @@ public class DataSoruceConfig {
|
||||
* @return the dialect
|
||||
*/
|
||||
public String getDialect() {
|
||||
if(this.dialect==null) {
|
||||
this.dialect=Dialect.getDialectMap().get(database);
|
||||
}
|
||||
return dialect;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
package org.maxkey.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:/config/applicationConfig.properties")
|
||||
public class EmailConfig {
|
||||
|
||||
@Value("${config.email.username}")
|
||||
private String username;
|
||||
|
||||
@Value("${config.email.password}")
|
||||
private String password;
|
||||
|
||||
@Value("${config.email.smtpHost}")
|
||||
private String smtpHost;
|
||||
|
||||
@Value("${config.email.senderMail}")
|
||||
private String senderMail;
|
||||
|
||||
@Value("${config.email.port}")
|
||||
private Integer port;
|
||||
|
||||
@Value("${config.email.ssl}")
|
||||
private boolean ssl;
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
package org.maxkey.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:/config/applicationLogin.properties")
|
||||
public class LoginConfig {
|
||||
|
||||
@Value("${config.login.captcha}")
|
||||
boolean captcha;
|
||||
|
||||
@Value("${config.login.onetimepwd}")
|
||||
boolean oneTimePwd;
|
||||
|
||||
@Value("${config.login.socialsignon}")
|
||||
boolean socialSignOn;
|
||||
|
||||
|
||||
@Value("${config.login.kerberos}")
|
||||
boolean kerberos;
|
||||
|
||||
@Value("${config.login.remeberme}")
|
||||
boolean remeberMe;
|
||||
|
||||
@Value("${config.login.wsfederation}")
|
||||
boolean wsFederation;
|
||||
|
||||
@Value("${config.login.default.uri}")
|
||||
String defaultUri;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user