Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

빌드후 H2-console에 들어가지지 않는 것이 궁금합니다. #47

Open
ventulus95 opened this issue Dec 2, 2019 · 2 comments

Comments

@ventulus95
Copy link
Collaborator

buildJar를 통해서 빌드를 하고, 자바를 통해서 스프링부트를 키면 H2-console이 로그인되지 않는 이유가 궁금합니다. 직접적인 연결은 안되는 것 같은데 이것 역시 H2-console 설정관련된 것과 관련이 있을까요?

@benelog
Copy link
Owner

benelog commented Dec 3, 2019

네, jar 파일을 실행시킬때에는 java -Dgithub.token=xxx -Dspring.h2.console.enabled=true -jar devcenter-bot-0.0.1-SNAPSHOT.jar 와 같이 해당 속성을 켜줘야 동작합니다.

소스를 보니 원래 spring.h2.console.enabled의 디폴트 값은 false입니다.

https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleProperties.java#L41

IntelliJ 안에서 main메서드를 실행했을때는 들어가지는 이유는 저희가 build.gradle에 아래와 같이 추가한 devtools 때문인것으로 파악되었습니다.

developmentOnly 'org.springframework.boot:spring-boot-devtools'

devtools의 아래 소스를 보니, h2 console설정을 켜주는것을 알 수 있었습니다.

https://github.com/spring-projects/spring-boot/blob/eb4c5b1e3789c6e6fc2205f14ff6b655e555e39c/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java#L69

devtools는 실제 실행환경과 개발환경을 구분해서, 개발환경에서 켜면 편리한 속성들을 디폴트로 넣어줍니다.

덕분에 저도 소스를 살펴보게 되어서, 좋은 질문이였네요.

@ventulus95
Copy link
Collaborator Author

저도 궁금증이 많이 해결되었습니다!
또 이것저것 많이 시도해보고 더 해보겠습니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants