Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wentao 2021-06-07 16:16:20 +08:00
commit 58e102d26b
193 changed files with 922 additions and 289 deletions

View File

@ -7,7 +7,7 @@ jobs:
build-job:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
- image: circleci/openjdk:11.0.3-jdk-stretch
working_directory: ~/repo
@ -37,7 +37,7 @@ jobs:
deploy-job:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
- image: circleci/openjdk:11.0.3-jdk-stretch
working_directory: ~/repo

View File

@ -3,7 +3,7 @@ language: java
script: mvn -Dmaven.test.skip=true -Pdemo clean install --settings mvn_settings.xml --fail-at-end
dist: trusty
jdk:
- oraclejdk8
- oraclejdk11
# whitelist
#branches:
# only:

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-activiti</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-hystrix-dashboard</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-mybatis</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-ngrok</artifactId>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-uflo</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-ureport</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-urule</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-contrib</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-xxl-job-executor</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-parent</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-contrib</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-parent</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-core</artifactId>
<packaging>jar</packaging>
@ -43,6 +43,10 @@
<groupId>org.nutz</groupId>
<artifactId>nutz</artifactId>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>

View File

@ -1,30 +1,159 @@
package org.nutz.boot.config.impl;
import java.io.InputStream;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import org.nutz.lang.Streams;
import org.nutz.lang.Strings;
import org.nutz.lang.util.Disks;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.yaml.snakeyaml.Yaml;
import java.io.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* 未完成
* @author wendal(wendal1985@gmail.com)
*
* @author wizzer(wizer.cn@gmail.com)
*/
public class YamlConfigureLoader extends AbstractConfigureLoader {
private static final Log log = Logs.get();
public void init() throws Exception {
String path = envHolder.get("nutz.boot.configure.properties_path", "application.yml");
try (InputStream ins = resourceLoader.get(path)) {
if (ins == null) {
throw new RuntimeException("yaml not found : " + path);
String path = envHolder.get("nutz.boot.configure.yaml_path", "application.yaml");
// 另外,加载custom目录下的配置文件,与nutzcn一致
conf.setPaths("custom/");
// 如果当前文件夹存在application.yaml,读取之
boolean flag = true;
try {
File tmp = new File(getPath(path));
if (tmp.exists() && tmp.canRead()) {
try (FileInputStream ins = new FileInputStream(tmp)) {
log.debugf("load %s", tmp.getAbsolutePath());
yamlToProperties(new Yaml().loadAs(Streams.utf8r(ins), Map.class));
flag = false;
}
}
} catch (Throwable e) {
}
if (flag) {
// 加载application.yaml
readYamlPath(path);
}
// 也许命令行里面指定了profile,需要提前load进来
PropertiesProxy tmp = new PropertiesProxy();
if (args != null) {
parseCommandLineArgs(tmp, args);
if (tmp.has("nutz.profiles.active")) {
conf.put("nutz.profiles.active", tmp.remove("nutz.profiles.active"));
}
}
if (allowCommandLineProperties) {
conf.putAll(System.getProperties());
}
// 加载指定profile,如果有的话
if (conf.has("nutz.profiles.active")) {
String profile = conf.get("nutz.profiles.active");
String _path = path.substring(0, path.lastIndexOf('.')) + "-" + profile + ".yaml";
readYamlPath(_path);
}
// 如果conf内含有nutz.boot.configure.yaml.dir配置则读取该目录下的所有配置文件
// 配置示例 nutz.boot.configure.yaml.dir=config, 那么读取的就是jar包当前目录下config子目录下的所有yaml文件
if (conf.has("nutz.boot.configure.yaml.dir")) {
String configDir = conf.get("nutz.boot.configure.yaml.dir");
String configPath = getPath(configDir);
Disks.visitFile(configPath, ".+yaml", true, (file) -> {
if (file.canRead())
try {
try (FileInputStream ins = new FileInputStream(file)) {
yamlToProperties(new Yaml().loadAs(Streams.utf8r(ins), Map.class));
}
} catch (IOException e) {
log.info("fail to load " + file.getAbsolutePath());
}
});
}
// 把命令行参数放进去
if (tmp.size() > 0) {
conf.putAll(tmp.toMap());
}
if (Strings.isBlank(conf.get("app.build.version"))) {
InputStream ins = resourceLoader.get("build.version");
if (ins != null) {
conf.load(new InputStreamReader(ins), false);
}
conf = new PropertiesProxy();
readYaml(ins);
}
}
protected void readYaml(InputStream ins ) {
// 根据目录和文件名拼接绝对路径
protected String getPath(String... names) {
String tmp = Strings.join(File.separator, names);
if (tmp.endsWith("/"))
tmp = tmp.substring(0, tmp.length() - 1);
File f = new File(tmp);
if (f.exists()) {
String path = Disks.getCanonicalPath(tmp);
String path2 = Disks.getCanonicalPath(f.getAbsolutePath());
if (path.equals(path2))
return tmp;
}
return appContext.getBasePath() + File.separator + tmp;
}
protected void readYamlPath(String path) throws IOException {
try (InputStream ins = resourceLoader.get(path)) {
if (ins != null) {
if (log.isDebugEnabled())
log.debug("Loading yaml - " + path);
yamlToProperties(new Yaml().loadAs(Streams.utf8r(ins), Map.class));
} else {
if (log.isInfoEnabled())
log.info("Yaml NotFound - " + path);
}
}
}
private void yamlToProperties(Map map) {
Map<String, Object> result = new HashMap<>();
buildFlattenedMap(result, map, "");
conf.putAll(result);
}
private void buildFlattenedMap(Map<String, Object> result, Map<String, Object> source, String path) {
for (Map.Entry<String, Object> entry : source.entrySet()) {
String key = Strings.sNull(entry.getKey());
if (Strings.isNotBlank(path)) {
if (key.startsWith("[")) {
key = path + key;
} else {
key = path + "." + key;
}
}
Object value = entry.getValue();
if (value instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) value;
buildFlattenedMap(result, map, key);
} else if (value instanceof Collection) {
@SuppressWarnings("unchecked")
Collection<Object> collection = (Collection<Object>) value;
StringBuilder val = new StringBuilder();
for (Object object : collection) {
String str = Strings.sNull(object);
if (str.startsWith("{") && str.endsWith("}")) {
val.append(Json.toJson(object, JsonFormat.compact())).append("\n");
} else {
val.append(str).append("\n");
}
}
result.put(key, val.toString());
} else {
result.put(key, Strings.sNull(value));
}
}
}
}

View File

@ -5,4 +5,4 @@
| |\ || |_/ / |______|______|______|______|______| |/ /
\_| \_/\____/ |_/_/
:: Nutz Boot :: (2.4.2-SNAPSHOT)
:: Nutz Boot :: (2.4.2.v20201205)

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>nutzboot-demo-cloud</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nutzboot-demo-cloud-client</artifactId>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>nutzboot-demo-cloud</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nutzboot-demo-cloud-eureka-server</artifactId>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>nutzboot-demo-cloud</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nutzboot-demo-cloud-service</artifactId>
@ -39,7 +39,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
<version>8.0.16</version>
</dependency>
</dependencies>
<build>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-cloud</artifactId>
<packaging>pom</packaging>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-custom</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-custom-starter</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-custom</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-cxf</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-cxf-client</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-cxf</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-cxf-common</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-cxf</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-cxf-service</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-cxf</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo-seata</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-seata-account</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo-seata</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-seata-common</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo-seata</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-seata-order</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo-seata</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-seata-storage</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo-seata</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-seata-web</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-seata</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-common</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-rpc-client</artifactId>
<dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-dubbo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo-rpc-service</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-dubbo</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>nutzboot-demo-feign</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nutzboot-demo-feign-client-json</artifactId>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>nutzboot-demo-feign</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nutzboot-demo-feign-service</artifactId>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-feign</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-servicecomb</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-servicecomb-common</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-servicecomb</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-servicecomb-rpc-client</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-servicecomb</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-servicecomb-rpc-service</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-servicecomb</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-activiti</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-apollo-client</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-beetl</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-beetlsql</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-caffeine</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-config-client</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-dao-with-many</artifactId>
<properties>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-dao-with-slave</artifactId>
<properties>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-dao</artifactId>
<properties>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -28,7 +28,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.0</version>
<version>2.13.2</version>
</dependency>
</dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-email</artifactId>
<dependencies>

View File

@ -1,7 +1,7 @@
server.port=8080
server.host=0.0.0.0
email.HostName=smtp.exmail.qq.com
email.HostName=smtp.qq.com
email.SmtpPort=465
email.UserName=
email.Password=

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-eureka-client</artifactId>
<dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<properties>

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<properties>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-hystrix</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-j2cache</artifactId>
<dependencies>

View File

@ -0,0 +1,7 @@
FROM azul/zulu-openjdk:8
MAINTAINER wendal <wendal1985@gmail.com>
ENTRYPOINT ["/usr/bin/java", "-jar", "/usr/share/nb.jar"]
# Add the service itself
ARG JAR_FILE
ADD target/${JAR_FILE} /usr/share/nb.jar

View File

@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-jaspypt</artifactId>
<properties>
<docker.image.prefix>nutzboot</docker.image.prefix>
</properties>
<dependencies>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jasypt</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-nutz-mvc</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jetty</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,27 @@
package io.nutz.demo.simple;
import org.nutz.boot.NbApp;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean(create = "init")
public class MainLauncher {
@Inject
protected PropertiesProxy conf;
public void init() {
System.out.println("test enc");
System.out.println(conf.get("spring.datasource.username"));
}
// 默认配置的数据库是h2database,而且用了内存模式, 每次启动都是新的空白数据库
// 配置其他数据库时,请务必加上对应的驱动程序, h2的依赖可删除
public static void main(String[] args) throws Exception {
new NbApp().setPrintProcDoc(true).run();
}
}

View File

@ -0,0 +1,5 @@
server.port=8080
server.host=0.0.0.0
jasypt.encryptor.password=Yb7yYK77RTC11eAegWjJxGpZ2nCqG2c9
spring.datasource.username=ENC(gcdmg7IeRKFLsKizLW4gFFVsKuhziGGz1UlpBhQBhqXzHa3O6GYcUc+zjNxugq0t)

View File

@ -0,0 +1,8 @@
log4j.rootLogger=info,Console
log4j.logger.org.nutz=debug
log4j.logger.org.eclipse.jetty=info
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss.SSS}] %5p [%t] --- %c{1}: %m%n

View File

@ -0,0 +1,140 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Hello, So NB!</title>
<link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body style="background-color: #30bded;">
<div class="container-fluid">
<div class="row" id="app">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="row">
<h3>欢迎使用NutzBoot</h3>
</div>
<div class="row">
<p>本文件位于 src/main/resources/static/index.html 可以随意修改
</div>
<div class="row">
<p>当前毫秒数: <a href="#">{{timeNow}}</a>
</div>
<div class="row">
<p>NutzBoot官网 <a href="https://nutz.io" target="_blank">https://nutz.io</a>
</div>
<div class="row">
<p>项目构建器 <a href="https://get.nutz.io" target="_blank">https://get.nutz.io</a>
</div>
<div class="row">
<p>后台API(swagger自动生成) <a href="swagger/" target="_blank">swagger/</a>
</div>
<div class="row">
<p>数据库连接池监控(druid),用户druid,密码在日志里面搜druid password <a href="druid" target="_blank">druid/</a>
</div>
<div class="row">
<div>
<button class="btn btn-info" @click="user_add">新增</button>
<button class="btn btn-info" @click="pager.pageNumber-=1;dataReload();" v-if="pager.pageNumber > 1">上一页</button>
<button class="btn btn-info" @click="pager.pageNumber+=1;dataReload();" v-if="pager.pageNumber < pager.pageCount">下一页</button>
</div>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>id</th>
<th>名称</th>
<th>年龄</th>
<th>地区</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="user in users">
<td>{{user.id}}</td>
<td>{{user.name}}</td>
<td>{{user.age}}</td>
<td>{{user.location}}</td>
<td>
<button class="btn btn-info" @click="user_delete(user.id)">删除</button>
<button class="btn btn-info" @click="user_update(user, '输入新年龄', user.age, 'age')">更新年龄</button>
<button class="btn btn-info" @click="user_update(user, '输入新地区', user.location, 'location')">更新地区</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-2"></div>
</div>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.bootcss.com/vue/2.6.10/vue.min.js"></script>
<script type="text/javascript">
var _app = new Vue({
el : "#app",
data : {
timeNow : 0,
users : [],
pager : {
pageNumber : 1,
pageSize : 3,
pageCount : 1
}
},
methods : {
dataReload : function() {
$.ajax({
url : "user/query",
data : "pageSize=" + _app.pager.pageSize + "&pageNumber=" + _app.pager.pageNumber,
success : function(re) {
_app.users = re.data.list;
_app.pager = re.data.pager;
}
})
},
user_delete : function(user_id) {
$.ajax({
url : "user/delete",
type : "POST",
data : "id="+user_id,
success : function(re) {
_app.dataReload();
}
})
},
user_add : function(user_id) {
var name = prompt("输入新用户的名称", "");
if (!name)
return;
$.ajax({
url : "user/add",
type : "POST",
data : "name="+name,
success : function(re) {
_app.pager.pageNumber = 1
_app.dataReload();
}
})
},
user_update : function(user,msg, oldVal, key) {
var val = prompt(msg, (oldVal || "")+"");
if (!val)
return;
user[key] = val
$.ajax({
url : "user/update",
type : "POST",
data : JSON.stringify(user),
success : function(re) {
_app.dataReload();
}
})
}
}
});
_app.dataReload()
//setInterval(_app.dataReload, 1000)
</script>
</html>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-jetty-nacos-config-client</artifactId>
<dependencies>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-jetty-nacos-naming</artifactId>
<dependencies>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-jetty-sessionstore</artifactId>
<dependencies>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-jetty-with-jsp</artifactId>
<dependencies>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-jetty</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-jetx</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-mongodb</artifactId>
<dependencies>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-mqtt-client</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-mvc-ngrok</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-mvc-shiro</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-mvc-wkcache</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-mvc</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-prevent-duplicate-submit</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-quartz</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-rabbitmq</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-redis</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-redisson</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-sharding-jdbc</artifactId>
<dependencies>
@ -31,7 +31,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
<version>8.0.16</version>
</dependency>
</dependencies>
</project>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-sqlxmltpl</artifactId>
<properties>

View File

@ -25,6 +25,6 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
</project>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-swagger</artifactId>
<dependencies>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-thrift-server</artifactId>
<dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-thymeleaf-shiro</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-thymeleaf</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-tomcat</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-uflo</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-undertow</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-ureport</artifactId>
<dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-urule</artifactId>
<dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>nutzboot-demo-simple</artifactId>
<groupId>org.nutz</groupId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-web3j</artifactId>
<dependencies>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-demo-simple</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-demo-simple-webjars</artifactId>
<dependencies>

Some files were not shown because too many files have changed in this diff Show More