This commit is contained in:
2022-03-04 15:48:13 +09:00
parent 3e80f1b332
commit f381bfe5b1
14 changed files with 872 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ subprojects {
group = 'bit.space' group = 'bit.space'
version = '0.0.1-SNAPSHOT' version = '0.0.1-SNAPSHOT'
sourceCompatibility = '8' sourceCompatibility = '11'
repositories { repositories {
mavenCentral() mavenCentral()
@@ -23,13 +23,24 @@ subprojects {
} }
} }
ext {
set('springCloudVersion', "2021.0.0")
}
dependencies { dependencies {
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools' developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'org.springframework.boot:spring-boot-starter-actuator:2.5.5'
annotationProcessor 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
} }
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test { test {
useJUnitPlatform() useJUnitPlatform()
} }

View File

@@ -0,0 +1,4 @@
dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
}

View File

@@ -0,0 +1,15 @@
package bit.space;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class, args);
}
}

View File

@@ -0,0 +1,11 @@
server:
port: 8761
spring:
application:
name: eureka-server
eureka:
client:
register-with-eureka: false
fetch-registry: false

View File

@@ -0,0 +1,5 @@
dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
}

View File

@@ -0,0 +1,13 @@
package bit.space;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}

View File

@@ -0,0 +1,26 @@
server:
port: 10000
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defalutZone: http://localhost:8761/eureka
spring:
application:
name: gateway-server
cloud:
gateway:
routes:
- id: member-service
uri: lb://MEMBER-SERVICE
predicates:
- Path=/member-service/**
management:
endpoints:
web:
exposure:
include: health, info, metrics, prometheus, gateway

View File

@@ -1,6 +1,6 @@
dependencies { dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
} }

View File

@@ -2,7 +2,9 @@ package bit.space;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@EnableDiscoveryClient
@SpringBootApplication @SpringBootApplication
public class MemberApplication { public class MemberApplication {

View File

@@ -1,9 +1,11 @@
package bit.space.controller; package bit.space.controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping(path = "/member-service")
public class MemberController { public class MemberController {
@GetMapping("/api/welcome") @GetMapping("/api/welcome")

View File

@@ -1,2 +1,13 @@
server: server:
port: 9999 port: 10001
spring:
application:
name: member-service
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defalutZone: http://localhost:8761/eureka

File diff suppressed because it is too large Load Diff

View File

@@ -6,15 +6,30 @@
"@testing-library/jest-dom": "^5.16.2", "@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3", "@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",
"axios": "^0.26.0",
"cross-env": "^7.0.3",
"immutable": "^4.0.0",
"open-color": "^1.9.1",
"react": "^17.0.2", "react": "^17.0.2",
"react-click-outside": "^3.0.1",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-icons": "^4.3.1",
"react-immutable-proptypes": "^2.2.0",
"react-redux": "^7.2.6",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0", "react-scripts": "5.0.0",
"react-textarea-autosize": "^8.3.3",
"react-transition-group": "^4.4.2",
"redux": "^4.1.2",
"redux-actions": "^2.6.5",
"redux-pender": "^2.0.12",
"styled-components": "^5.3.3",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
"scripts": { "scripts": {
"start": "cross-env NODE_PATH=src react-scripts start", "start": "cross-env NODE_PATH=src react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
"eslintConfig": { "eslintConfig": {

View File

@@ -7,7 +7,7 @@ function App() {
const [message, setMessage] = useState(""); const [message, setMessage] = useState("");
useEffect(() => { useEffect(() => {
fetch('/api/welcome') fetch('/member-service/api/welcome')
.then(response => response.text()) .then(response => response.text())
.then(message => { .then(message => {
setMessage(message); setMessage(message);