Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringCloud-study
提交
ed695794
S
SpringCloud-study
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringCloud-study
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringCloud-study
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
ed695794
编写于
1月 08, 2023
作者:
Q
qinyingjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:添加portal模块
上级
cac144cc
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
141 addition
and
0 deletion
+141
-0
pom.xml
pom.xml
+1
-0
springcloud-service-common/pom.xml
springcloud-service-common/pom.xml
+6
-0
springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java
...src/main/java/com/kwan/springcloud/config/RestConfig.java
+14
-0
springcloud-service-portal/pom.xml
springcloud-service-portal/pom.xml
+47
-0
springcloud-service-portal/src/main/java/com/kwan/springcloud/PortalApplication.java
...src/main/java/com/kwan/springcloud/PortalApplication.java
+13
-0
springcloud-service-portal/src/main/java/com/kwan/springcloud/controller/PortalController.java
...ava/com/kwan/springcloud/controller/PortalController.java
+44
-0
springcloud-service-portal/src/main/resources/application.yaml
...gcloud-service-portal/src/main/resources/application.yaml
+3
-0
springcloud-service-portal/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
...est/java/com/kwan/springcloud/PortalApplicationTests.java
+13
-0
未找到文件。
pom.xml
浏览文件 @
ed695794
...
...
@@ -27,6 +27,7 @@
<modules>
<module>
springcloud-service-goods
</module>
<module>
springcloud-service-common
</module>
<module>
springcloud-service-portal
</module>
</modules>
<dependencyManagement>
...
...
springcloud-service-common/pom.xml
浏览文件 @
ed695794
...
...
@@ -23,6 +23,12 @@
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java
0 → 100644
浏览文件 @
ed695794
package
com.kwan.springcloud.config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.client.RestTemplate
;
@Configuration
public
class
RestConfig
{
@Bean
public
RestTemplate
restTemplate
()
{
return
new
RestTemplate
();
}
}
springcloud-service-portal/pom.xml
0 → 100644
浏览文件 @
ed695794
<?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>
<parent>
<groupId>
com.kwan.springcloud
</groupId>
<artifactId>
springcloud-service-parent
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
springcloud-service-portal
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
springcloud-service-portal
</name>
<properties>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
com.kwan.springcloud
</groupId>
<artifactId>
springcloud-service-common
</artifactId>
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
<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>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
springcloud-service-portal/src/main/java/com/kwan/springcloud/PortalApplication.java
0 → 100644
浏览文件 @
ed695794
package
com.kwan.springcloud
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
PortalApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
PortalApplication
.
class
,
args
);
}
}
springcloud-service-portal/src/main/java/com/kwan/springcloud/controller/PortalController.java
0 → 100644
浏览文件 @
ed695794
package
com.kwan.springcloud.controller
;
import
com.kwan.springcloud.response.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.Serializable
;
/**
* portal控制器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/1/8 11:12
*/
@RestController
@RequestMapping
(
"portal"
)
public
class
PortalController
{
private
static
final
String
GOODS_URL
=
"http://localhost:9100/kwanGoodsInfo/"
;
/**
* 服务对象
*/
@Autowired
private
RestTemplate
restTemplate
;
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping
(
"{id}"
)
public
Result
selectOne
(
@PathVariable
Serializable
id
)
{
//调用远程的controller
ResponseEntity
<
Result
>
forEntity
=
restTemplate
.
getForEntity
(
GOODS_URL
+
id
,
Result
.
class
);
return
Result
.
ok
(
forEntity
);
}
}
\ No newline at end of file
springcloud-service-portal/src/main/resources/application.yaml
0 → 100644
浏览文件 @
ed695794
#端口号
server
:
port
:
8080
\ No newline at end of file
springcloud-service-portal/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
0 → 100644
浏览文件 @
ed695794
package
com.kwan.springcloud
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
class
PortalApplicationTests
{
@Test
void
contextLoads
()
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录