Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
open-platform-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d00b924a
authored
Dec 15, 2020
by
fz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.初始化项目正常运行
1 parent
ec6a4094
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
53 deletions
src/main/java/com/glsx/Main.java
src/main/java/com/glsx/config/DubboConfig.java
src/main/java/com/glsx/config/SystemProperty.java
src/main/java/com/glsx/controller/IndexController.java
src/main/resources/config/application.properties
src/main/resources/logback.xml
src/main/java/com/glsx/Main.java
View file @
d00b924
src/main/java/com/glsx/config/DubboConfig.java
deleted
100644 → 0
View file @
ec6a409
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();
}*/
}
src/main/java/com/glsx/config/SystemProperty.java
View file @
d00b924
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
n
ame
)
{
public
String
getProperty
(
String
propertyN
ame
)
{
this
.
name
=
name
;
return
environment
.
getProperty
(
propertyName
)
;
}
}
}
}
src/main/java/com/glsx/controller/IndexController.java
View file @
d00b924
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"
;
}
}
}
}
src/main/resources/config/application.properties
View file @
d00b924
...
@@ -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
src/main/resources/logback.xml
View file @
d00b924
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment