diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..aa072c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# Basic Template Dockerfile +FROM openjdk:8-jdk-alpine + +ARG JAR_FILE=target/*.jar +COPY ${JAR_FILE} app.jar + +ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a881258 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: "3.8" +services: + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:6.8.6 + container_name: elasticsearch + restart: unless-stopped + ports: + - "9200:9200" + - "9300:9300" + environment: + cluster.name: elasticsearch + discovery.type: single-node + bootstrap.memory_lock: "true" + ES_JAVA_OPTS: "-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 + healthcheck: + test: "curl -f http://localhost:9200 || exit 1" + start_period: 1m + +# elastic-boot: +# container_name: elastic-boot-container +# build: +# context: ./ +# dockerfile: Dockerfile +# ports: +# - "8090:8090" +# depends_on: # Start the depends_on first +# - elasticsearch +# healthcheck: +# test: "wget --quiet --tries=1 --spider http://localhost:8090 || exit 1" +# restart: unless-stopped + diff --git a/src/main/java/com/thelivelock/elasticsearch_autocomplete/service/UserService.java b/src/main/java/com/thelivelock/elasticsearch_autocomplete/service/UserService.java index f4836d8..a917e7b 100644 --- a/src/main/java/com/thelivelock/elasticsearch_autocomplete/service/UserService.java +++ b/src/main/java/com/thelivelock/elasticsearch_autocomplete/service/UserService.java @@ -16,9 +16,12 @@ import java.util.stream.Collectors; @Service +@RequiredArgsConstructor public class UserService { + @Autowired private UserRepository userRepository; + @Autowired private ElasticsearchOperations elasticsearchOperations;