mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-02 11:58:01 +08:00
外部配置读取相对路径
This commit is contained in:
parent
e67b430e96
commit
4f8b4d795e
@ -22,7 +22,7 @@
|
||||
<!--复制外部配置文件-->
|
||||
<fileSet>
|
||||
<directory>${basedir}/src/main/resources/bin/</directory>
|
||||
<outputDirectory>/lib/</outputDirectory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<includes>
|
||||
<include>extConfig.yml</include>
|
||||
</includes>
|
||||
|
@ -33,7 +33,7 @@ public class ExtConfigBean {
|
||||
String path = (home.getSource() == null ? "" : home.getSource().getAbsolutePath());
|
||||
File file = new File(path);
|
||||
if (file.isFile()) {
|
||||
file = file.getParentFile();
|
||||
file = file.getParentFile().getParentFile();
|
||||
} else {
|
||||
file = new File(file, "bin");
|
||||
}
|
||||
|
@ -18,8 +18,11 @@ import java.io.IOException;
|
||||
*/
|
||||
public class ExtConfigEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
||||
|
||||
private static ConfigurableEnvironment configurableEnvironment;
|
||||
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
|
||||
configurableEnvironment = environment;
|
||||
File directory = ExtConfigBean.getFile();
|
||||
if (!directory.exists()) {
|
||||
return;
|
||||
|
@ -11,6 +11,7 @@ import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.boot.ApplicationHome;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -67,9 +68,15 @@ public class WebAopLog extends PropertyDefinerBase {
|
||||
public String getPropertyValue() {
|
||||
String path = JpomApplication.getArgs("jpom.log");
|
||||
if (StrUtil.isEmpty(path)) {
|
||||
File directory = new File("");
|
||||
directory = new File(directory.getAbsolutePath(), "log");
|
||||
path = directory.getPath();
|
||||
//
|
||||
ApplicationHome home = new ApplicationHome(WebAopLog.class);
|
||||
path = (home.getSource() == null ? "" : home.getSource().getAbsolutePath());
|
||||
File file = new File(path);
|
||||
if (file.isFile()) {
|
||||
file = file.getParentFile().getParentFile();
|
||||
}
|
||||
file = new File(file, "log");
|
||||
path = file.getPath();
|
||||
}
|
||||
// 配置默认日志路径
|
||||
DefaultSystemLog.configPath(path, false);
|
||||
|
@ -96,7 +96,7 @@
|
||||
id: 'table_project',
|
||||
elem: '#tab_project',
|
||||
url: '/manage/getProjectInfo',
|
||||
height: 'full-52',
|
||||
// height: 'full-52',
|
||||
even: true,
|
||||
cols: [[{
|
||||
field: 'name', title: '项目名称', width: '15%', templet: function (d) {
|
||||
@ -248,7 +248,7 @@
|
||||
|
||||
function reloadTable() {
|
||||
table.reload('table_project', {
|
||||
height: 'full-52'
|
||||
// height: 'full-52'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user