Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringCloudAlibaba
提交
4958c828
S
SpringCloudAlibaba
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringCloudAlibaba
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringCloudAlibaba
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4958c828
编写于
1月 17, 2023
作者:
Q
qinyingjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:配置信息
上级
9b0e1bee
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
303 addition
and
38 deletion
+303
-38
pom.xml
pom.xml
+0
-38
springcloudalibaba-server-nacos-producer/pom.xml
springcloudalibaba-server-nacos-producer/pom.xml
+90
-0
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/NacosApplication.java
...in/java/com/kwan/springcloudalibaba/NacosApplication.java
+12
-0
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/common/Result.java
.../main/java/com/kwan/springcloudalibaba/common/Result.java
+119
-0
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/constant/CommonConstant.java
.../com/kwan/springcloudalibaba/constant/CommonConstant.java
+16
-0
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/controller/NacosController.java
...m/kwan/springcloudalibaba/controller/NacosController.java
+27
-0
springcloudalibaba-server-nacos-producer/src/main/resources/application.yml
...-server-nacos-producer/src/main/resources/application.yml
+26
-0
springcloudalibaba-server-nacos-producer/src/test/java/com/kwan/springcloudalibaba/NacosApplicationTests.java
...va/com/kwan/springcloudalibaba/NacosApplicationTests.java
+13
-0
未找到文件。
pom.xml
已删除
100644 → 0
浏览文件 @
9b0e1bee
<?xml version="1.0" encoding="UTF-8"?>
<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.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.3.2.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>
com.kwan.springcloudalibaba
</groupId>
<artifactId>
springcloudalibaba-service-parent
</artifactId>
<version>
1.0.0
</version>
<properties>
<maven.compiler.source>
8
</maven.compiler.source>
<maven.compiler.target>
8
</maven.compiler.target>
<java.version>
1.8
</java.version>
<!-- 与1.8配置在一起,设置编码集-->
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
</properties>
<modules>
<!-- <module>springcloud-service-eureka</module>-->
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
Hoxton.SR12
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<packaging>
pom
</packaging>
</project>
\ No newline at end of file
springcloudalibaba-server-nacos-producer/pom.xml
0 → 100644
浏览文件 @
4958c828
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.kwan.springcloudalibaba
</groupId>
<artifactId>
springcloudalibaba-server-nacos-producer
</artifactId>
<name>
springcloudalibaba-server-nacos-producer
</name>
<description>
springcloudalibaba-server-nacos-producer
</description>
<version>
1.0.0
</version>
<properties>
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<spring-boot.version>
2.3.0.RELEASE
</spring-boot.version>
<spring-cloud-alibaba.version>
2.2.1.RELEASE
</spring-cloud-alibaba.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-alibaba-dependencies
</artifactId>
<version>
${spring-cloud-alibaba.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-dependencies</artifactId>-->
<!-- <version>${spring-cloud.version}</version>-->
<!-- <type>pom</type>-->
<!-- <scope>import</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
${spring-boot.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
7
</source>
<target>
7
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/NacosApplication.java
0 → 100644
浏览文件 @
4958c828
package
com.kwan.springcloudalibaba
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
NacosApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
NacosApplication
.
class
,
args
);
}
}
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/common/Result.java
0 → 100644
浏览文件 @
4958c828
package
com.kwan.springcloudalibaba.common
;
import
com.kwan.springcloudalibaba.constant.CommonConstant
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 接口返回数据格式
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/1/8 10:48
*/
@Data
public
class
Result
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 成功标志
*/
private
boolean
success
=
true
;
/**
* 返回处理消息
*/
private
String
message
=
"操作成功!"
;
/**
* 返回代码
*/
private
Integer
code
=
0
;
/**
* 返回数据对象 data
*/
private
T
result
;
/**
* 时间戳
*/
private
long
timestamp
=
System
.
currentTimeMillis
();
public
Result
()
{
}
public
Result
<
T
>
success
(
String
message
)
{
this
.
message
=
message
;
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
return
this
;
}
public
Result
<
T
>
good
(
T
t
)
{
this
.
setResult
(
t
);
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
return
this
;
}
public
Result
<
T
>
good
()
{
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
this
.
setMessage
(
"成功"
);
return
this
;
}
public
Result
<
T
>
fail
(
String
msg
)
{
this
.
setCode
(
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
);
this
.
setMessage
(
msg
);
this
.
setSuccess
(
false
);
return
this
;
}
public
static
Result
<
Object
>
ok
()
{
Result
<
Object
>
r
=
new
Result
<>();
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
setMessage
(
"成功"
);
return
r
;
}
public
static
Result
<
Object
>
ok
(
String
msg
)
{
Result
<
Object
>
r
=
new
Result
<>();
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
setMessage
(
msg
);
return
r
;
}
public
static
Result
<
Object
>
ok
(
Object
data
)
{
Result
<
Object
>
r
=
new
Result
<
Object
>();
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
setResult
(
data
);
return
r
;
}
public
static
Result
<
Object
>
error
(
String
msg
)
{
return
error
(
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
,
msg
);
}
public
static
Result
<
Object
>
error
(
int
code
,
String
msg
)
{
Result
<
Object
>
r
=
new
Result
<
Object
>();
r
.
setCode
(
code
);
r
.
setMessage
(
msg
);
r
.
setSuccess
(
false
);
return
r
;
}
public
Result
<
T
>
error500
(
String
message
)
{
this
.
message
=
message
;
this
.
code
=
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
;
this
.
success
=
false
;
return
this
;
}
/**
* 无权限访问返回结果
*/
public
static
Result
<
Object
>
noauth
(
String
msg
)
{
return
error
(
CommonConstant
.
SC_JEECG_NO_AUTHZ
,
msg
);
}
}
\ No newline at end of file
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/constant/CommonConstant.java
0 → 100644
浏览文件 @
4958c828
package
com.kwan.springcloudalibaba.constant
;
public
class
CommonConstant
{
/**
* 成功
*/
public
static
final
Integer
SC_OK_200
=
200
;
/**
* 服务器错误
*/
public
static
final
Integer
SC_INTERNAL_SERVER_ERROR_500
=
500
;
/**
* 未认证
*/
public
static
final
int
SC_JEECG_NO_AUTHZ
=
401
;
}
\ No newline at end of file
springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/controller/NacosController.java
0 → 100644
浏览文件 @
4958c828
package
com.kwan.springcloudalibaba.controller
;
import
com.kwan.springcloudalibaba.common.Result
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/nacos"
)
public
class
NacosController
{
@Value
(
"${user.name}"
)
private
String
nameInfo
;
/**
* 获取配置的变量
*/
@GetMapping
(
value
=
"/nameInfo"
,
produces
=
MediaType
.
APPLICATION_PROBLEM_JSON_VALUE
)
public
Result
nameInfo
()
{
return
Result
.
ok
(
nameInfo
);
}
}
springcloudalibaba-server-nacos-producer/src/main/resources/application.yml
0 → 100644
浏览文件 @
4958c828
#端口号
server
:
port
:
18082
#断电打开
management
:
endpoint
:
health
:
show-details
:
always
endpoints
:
jmx
:
exposure
:
include
:
'
*'
web
:
exposure
:
include
:
'
*'
#spring配置
spring
:
application
:
name
:
nacos-producer
cloud
:
nacos
:
discovery
:
server-addr
:
192.168.172.128:8848
password
:
nacos
username
:
nacos
springcloudalibaba-server-nacos-producer/src/test/java/com/kwan/springcloudalibaba/NacosApplicationTests.java
0 → 100644
浏览文件 @
4958c828
package
com.kwan.springcloudalibaba.springcloudalibabaservernacos
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
class
NacosApplicationTests
{
@Test
void
contextLoads
()
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录