Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 배포전략
- spring boot
- API MARKETPLACE 글로벌 홍보 서포터즈
- 대외활동
- naver
- Integrations & services
- k8s
- 젠킨스
- re2.node
- Elk
- LOG
- Docker 명령어
- identity center
- slf4j
- 서포터즈
- 특정 커밋 삭제
- jenkins
- 특정커밋
- 글로벌 홍보 서포터즈
- 사용자 추가
- 2022
- API MARKETPLACE
- APIMARKETPLACE
- k8s 구성요소
- 블루 그린
- 젠킨스 설치
- log4j2
- 네이버
- Docker
- 커밋삭제
Archives
- Today
- Total
G코딩 스토리
[Spring Boot + ELK] ELK에서 Spring Boot로 데이터 전달하는 방법 본문
1. 설정
Maven - pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
Gradle - build.gradle
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'
}
application.properties
spring.data.elasticsearch.cluster-nodes=localhost:9200
spring.data.elasticsearch.cluster-name=your-cluster-name
2. Entity 구현
Entity
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
@Document(indexName = "bids")
public class Bid {
@Id
private String id;
private Long userId;
private Long itemId;
private Double amount;
// getters and setters
}
3. Repository 구현
Repository
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import java.util.List;
public interface BidRepository extends ElasticsearchRepository<Bid, String> {
// 특정 사용자의 입찰 기록 조회
List<Bid> findByUserId(Long userId);
// 특정 물품에 대한 모든 입찰 기록 조회
List<Bid> findByItemId(Long itemId);
}
'Develop > Spring' 카테고리의 다른 글
[Spring Boot] Log4j2 로그를 여러 개의 파일에 저장하는 방법 (0) | 2024.08.02 |
---|