Commit d00b924a by fz

1.初始化项目正常运行

1 parent ec6a4094
......@@ -22,7 +22,7 @@ public class Main extends AbsOreBootStarter {
{
SpringApplication.run(Main.class, args);
}
public static void main(String[] args)
{
Main main = new Main();
......
package com.glsx.config;
import org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Title: DubboConfig.java
* @Description: Dubbo服务注册配置
* @author deployer name
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@Configuration
public class DubboConfig {
@Autowired
private ReferenceBuilderFactory factory;
/**
* 注册远程服务(示例)
* RpcRemote为需要调用的远程服务
* @return
*/
/*@Bean
public RpcRemote rpcApiMethodRemote(){
return factory.builder(RpcRemote.class).check(false).timeout(30000).build();
}*/
}
package com.glsx.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
/**
* @Title: SystemProperty.java
......@@ -12,18 +14,15 @@ import org.springframework.context.annotation.Configuration;
* @Copyright Copyright (c) 2017
*/
@Configuration
@ConfigurationProperties("system")
public class SystemProperty {
// 对应配置项:system.name
private String name;
public class SystemProperty implements EnvironmentAware {
private static Environment environment;
public String getName() {
return name;
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
public void setName(String name) {
this.name = name;
public String getProperty(String propertyName) {
return environment.getProperty(propertyName);
}
}
package com.glsx.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.ModelMap;
import com.glsx.config.SystemProperty;
import org.springframework.web.bind.annotation.RestController;
/**
* @Title: IndexController.java
......@@ -15,7 +14,8 @@ import com.glsx.config.SystemProperty;
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Controller
@RestController
@RequestMapping("index")
public class IndexController {
@Autowired
......@@ -27,9 +27,8 @@ public class IndexController {
return "hello, welcome to home!";
}
@RequestMapping("index")
public String index(ModelMap map){
map.addAttribute("name", systemProperty.getName());
return "index";
@RequestMapping("fz")
public String index(){
return systemProperty.getProperty("system.name");
}
}
......@@ -4,12 +4,12 @@ server.servlet.context-path=/open-platform-api
server.servlet.application-display-name=open-platform-api
logging.config=classpath:logback.xml
logging.path=/data/java_log/jetty/open-platform-api/open-platform-api.log
#logging.path=/data/java_log/jetty/open-platform-api/open-platform-api.log
logging.level.root=INFO
ore.starter.class-name=Main
# diamond config
ore.diamond.group=diamond group
ore.diamond.group=open-platform
ore.diamond.dataId=open-platform-api
ore.diamond.env=release
\ No newline at end of file
ore.diamond.env=dev
\ No newline at end of file
......@@ -3,7 +3,7 @@
<property resource="config/application.properties" />
<property name="APP_NAME" value="${server.display-name}" />
<property name="LOG_PATH" value="${logging.path}" />
<!-- <property name="LOG_PATH" value="${logging.path}" />-->
<property name="LOG_LEVEL" value="${logging.level}" />
<contextName>${APP_NAME}</contextName>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!