cromono / log-consumer

0 stars 0 forks source link

스프링 배포 이미지 설정값 injection 오류 #8

Closed copolio closed 3 years ago

copolio commented 3 years ago

In GitLab by @gm2202981 on Jul 7, 2021, 16:41

개요

버그 내용

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authController' defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/gabia/cronMonitoring/controller/AuthController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authService' defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/gabia/cronMonitoring/service/AuthService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenProvider' defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/gabia/cronMonitoring/util/jwt/TokenProvider.class]: Unexpected exception during bean creation; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jwt.secret' in value "${jwt.secret}"

버그 재현 코드

FROM openjdk:11
VOLUME /tmp
ARG JAR_FILE=build/libs/*-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

해결 방안

FROM openjdk:11
VOLUME /tmp
ARG JAR_FILE=build/libs/*-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Dspring.profiles.active=prod", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

추후 고려사항

copolio commented 3 years ago

In GitLab by @gm2202981 on Jul 7, 2021, 16:51

mentioned in merge request !7