初始化提交
parent
6502c36e23
commit
74a3a4b34a
4
pom.xml
4
pom.xml
|
|
@ -71,7 +71,9 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.cloudowr</groupId>
|
<groupId>cn.cloudowr</groupId>
|
||||||
<artifactId>sdk</artifactId>
|
<artifactId>sdk</artifactId>
|
||||||
<version>1.3.4</version>
|
<version>1.4.16</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/lib/sdk-1.4.16.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package cn.cloudowr.ywxj.shangbao;
|
package cn.cloudowr.ywxj.shangbao;
|
||||||
|
|
||||||
import cn.cloudowr.sdk.JQueryParameterFilter;
|
|
||||||
import cn.cloudowr.sdk.jfinal.ErrorInterceptor;
|
import cn.cloudowr.sdk.jfinal.ErrorInterceptor;
|
||||||
|
import cn.cloudowr.sdk.jfinal.JQueryParameterFilter;
|
||||||
import com.jfinal.config.*;
|
import com.jfinal.config.*;
|
||||||
import com.jfinal.template.Engine;
|
import com.jfinal.template.Engine;
|
||||||
import com.mongodb.MongoClient;
|
import com.mongodb.MongoClient;
|
||||||
|
|
@ -11,12 +11,15 @@ import com.mongodb.client.MongoDatabase;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static cn.cloudowr.ywxj.shangbao.Main.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyf66 on 2017/2/18.
|
* Created by lyf66 on 2017/2/18.
|
||||||
*/
|
*/
|
||||||
public class Config extends JFinalConfig{
|
public class Config extends JFinalConfig{
|
||||||
private static MongoDatabase mongoDatabase;
|
private static MongoDatabase mongoDatabase;
|
||||||
|
|
||||||
|
|
||||||
public static MongoDatabase getMongoDatabase() {
|
public static MongoDatabase getMongoDatabase() {
|
||||||
return mongoDatabase;
|
return mongoDatabase;
|
||||||
}
|
}
|
||||||
|
|
@ -80,9 +83,9 @@ public class Config extends JFinalConfig{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterJFinalStart() {
|
public void afterJFinalStart() {
|
||||||
MongoCredential mongoCredential = MongoCredential.createCredential("root", "admin", "CoWR1111".toCharArray());
|
MongoCredential mongoCredential = MongoCredential.createCredential(username, database, password.toCharArray());
|
||||||
MongoClient mongoClient = new MongoClient(new ServerAddress("120.24.5.249", 3717), Arrays.asList(mongoCredential));
|
MongoClient mongoClient = new MongoClient(new ServerAddress(host, port), Arrays.asList(mongoCredential));
|
||||||
mongoDatabase = mongoClient.getDatabase("dict");
|
mongoDatabase = mongoClient.getDatabase(dabaseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,38 @@ package cn.cloudowr.ywxj.shangbao;
|
||||||
|
|
||||||
import com.jfinal.core.JFinal;
|
import com.jfinal.core.JFinal;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyf66 on 2017/2/16.
|
* Created by lyf66 on 2017/2/16.
|
||||||
*/
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
|
public static String username;
|
||||||
|
public static String database;
|
||||||
|
public static String password;
|
||||||
|
public static String host;
|
||||||
|
public static int port;
|
||||||
|
public static String dabaseName;
|
||||||
|
private static int AppPort;
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
JFinal.start("src/main/webapp", 4206, "/");
|
read();
|
||||||
|
JFinal.start("src/main/webapp", AppPort, "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void read(){
|
||||||
|
try{
|
||||||
|
Properties pro = new Properties();
|
||||||
|
pro.load(Config.class.getResourceAsStream("/config.properties"));
|
||||||
|
username = pro.getProperty("username");
|
||||||
|
database = pro.getProperty("database");
|
||||||
|
password = pro.getProperty("password");
|
||||||
|
host = pro.getProperty("host");
|
||||||
|
port = Integer.parseInt(pro.getProperty("port"));
|
||||||
|
dabaseName = pro.getProperty("dabaseName");
|
||||||
|
AppPort = Integer.parseInt(pro.getProperty("AppPort"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
username=root
|
||||||
|
database=admin
|
||||||
|
password=CoWR1111
|
||||||
|
host=120.24.5.249
|
||||||
|
port=3717
|
||||||
|
dabaseName=dict
|
||||||
|
AppPort=4206
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||||
|
version="3.1">
|
||||||
|
</web-app>
|
||||||
Loading…
Reference in New Issue