Commit d00b924a by fz

1.初始化项目正常运行

1 parent ec6a4094
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; package com.glsx.config;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
/** /**
* @Title: SystemProperty.java * @Title: SystemProperty.java
...@@ -12,18 +14,15 @@ import org.springframework.context.annotation.Configuration; ...@@ -12,18 +14,15 @@ import org.springframework.context.annotation.Configuration;
* @Copyright Copyright (c) 2017 * @Copyright Copyright (c) 2017
*/ */
@Configuration @Configuration
@ConfigurationProperties("system") public class SystemProperty implements EnvironmentAware {
public class SystemProperty { private static Environment environment;
// 对应配置项:system.name @Override
private String name; public void setEnvironment(Environment environment) {
this.environment = environment;
public String getName() {
return name;
} }
public void setName(String name) { public String getProperty(String propertyName) {
this.name = name; return environment.getProperty(propertyName);
} }
} }
package com.glsx.controller; package com.glsx.controller;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.ModelMap;
import com.glsx.config.SystemProperty; import com.glsx.config.SystemProperty;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @Title: IndexController.java * @Title: IndexController.java
...@@ -15,7 +14,8 @@ import com.glsx.config.SystemProperty; ...@@ -15,7 +14,8 @@ import com.glsx.config.SystemProperty;
* @Company: Didihu.com.cn * @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017 * @Copyright Copyright (c) 2017
*/ */
@Controller @RestController
@RequestMapping("index")
public class IndexController { public class IndexController {
@Autowired @Autowired
...@@ -27,9 +27,8 @@ public class IndexController { ...@@ -27,9 +27,8 @@ public class IndexController {
return "hello, welcome to home!"; return "hello, welcome to home!";
} }
@RequestMapping("index") @RequestMapping("fz")
public String index(ModelMap map){ public String index(){
map.addAttribute("name", systemProperty.getName()); return systemProperty.getProperty("system.name");
return "index";
} }
} }
...@@ -4,12 +4,12 @@ server.servlet.context-path=/open-platform-api ...@@ -4,12 +4,12 @@ server.servlet.context-path=/open-platform-api
server.servlet.application-display-name=open-platform-api server.servlet.application-display-name=open-platform-api
logging.config=classpath:logback.xml 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 logging.level.root=INFO
ore.starter.class-name=Main ore.starter.class-name=Main
# diamond config # diamond config
ore.diamond.group=diamond group ore.diamond.group=open-platform
ore.diamond.dataId=open-platform-api ore.diamond.dataId=open-platform-api
ore.diamond.env=release
\ No newline at end of file \ No newline at end of file
ore.diamond.env=dev
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<property resource="config/application.properties" /> <property resource="config/application.properties" />
<property name="APP_NAME" value="${server.display-name}" /> <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}" /> <property name="LOG_LEVEL" value="${logging.level}" />
<contextName>${APP_NAME}</contextName> <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!