# 배경상황
Spring in Action 제5판을 구입하여 실습코드를 따라하던 중 101페이지의 H2 콘솔에 접근해 보라는 책의 지문대로 웹 브라우저에 http://localhost:8080/h2-console 를 입력하였으나 하기와 같은 에러가 출력되었다.
# 배경지식
H2 database에 대하여 따로 설정을 하지 않으면 하기와 같이 기본적으로 설정이 된다고 한다.
"spring.h2.console.enabled=true" 로 설정을 변경해 주어야 한다.
# 해결방법
application.properties 파일에 "spring.h2.console.enabled=true" 로 설정을 변경한 후 서버를 재시작한다.
# 결론
H2 database를 사용하려고 의존성을 추가하면 바로 사용할 수 있는 것은 아니고 설정을 따로 해줘야 한다.
# 참조
https://github.com/spring-projects/spring-boot/issues/16509
https://developerhive.tistory.com/34
http://www.kyobobook.co.kr/product/detailViewKor.laf?mallGb=KOR&ejkGb=KOR&barcode=9791190665186
In English...
# Situation
I was following some code from book(Spring in Action No.5). It was about 101 page.
I just type "http://localhost:8080/h2-console" on the browser.
Some error occured like the below picture.
# Background
You just added H2 database Dependency in Spring boot project when you hadn't set any setting in "application.properties" file.
The default is like that. (when you heavn't changed any setting on your project)
So, You wanna use H2 database you should change the setting.
# Solution
Restart server after setting to add this code => "spring.h2.console.enabled=true" in "application.properties" file.
# Conclusion
If you want to use H2 database, you should add Dependency in Spring project then make some setting for use in application.properties file.
# References
https://github.com/spring-projects/spring-boot/issues/16509
https://developerhive.tistory.com/34
http://www.kyobobook.co.kr/product/detailViewKor.laf?mallGb=KOR&ejkGb=KOR&barcode=9791190665186
'개발 오류' 카테고리의 다른 글
Error - Can't create a java class file by intelliJ (0) | 2023.03.31 |
---|---|
[Spring in Action] H2 database 테이블 생성 안되는 오류 (2) | 2021.11.09 |
Web server failed to start. Port 8080 was already in use. (0) | 2021.08.20 |
[STS4] import javax.validation 오류 (0) | 2021.08.20 |
명령 프롬프트(CMD)에서 한글 깨짐 해결 (0) | 2021.08.14 |