728x90
반응형
1) pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
2) EurekaServerApplication.java
@EnableEurekaServer /* Eureka 사용을 위한 선언 (Eureka 서버 역할로 등록) */
위 코드를 추가하여 해당 서비스가 Eureka 서버 역할을 할 것임을 지정하자.
3) application.yml
server:
port: 8761 # Eureka Web Service 포트번호
spring:
application:
name: eurekaserver # 서비스명
eureka: # Eureka 라이브러리가 포함된채 부트가 실행되면 유레카 클라이언트 역할로써 어딘가에다 유레카를 등록한다.
client: # 기본값이 true 인데 자신의 정보를 자신에게 등록하는 의미없는 작업을 안하도록 false 지정
register-with-eureka: false
fetch-registry: false
server-port를 지정하고, 서비스 명을 지정하였다.
해당 프로젝트는 eureka server 역할을 하는 프로젝트이므로, client 를 지정할 필요가 없다. 따라서 default 인 true를 false로 지정해주자.
반응형
'Spring' 카테고리의 다른 글
SpringBoot + Microservice 프로젝트에서 Spring Cloud Config 적용하기 (0) | 2021.06.10 |
---|---|
Spring 에서 Entity -> Dto 로 변환하는 ModelMapper 사용 (0) | 2021.06.07 |
CommonException 으로 @Valid 어노테이션 BindingException, MethodArgumentNotValidException 처리하기 (0) | 2021.02.18 |
SpringBoot + PasswordEncoder 사용하여 패스워드 암/복호화 실행하기 (0) | 2021.02.18 |
SpringBoot에서 Redis로 Session 구현하기 (0) | 2021.02.14 |