🤍 전 강의 25% 할인 중 🤍

2024년 상반기를 돌아보고 하반기에도 함께 성장해요!
인프런이 준비한 25% 할인 받으러 가기 >>

  • 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

user-service h2-console연결이 안됨

22.12.26 22:49 작성 조회수 819

0

위 사진을 보면 user-service가 분명 떠잇어서 들어가서... 설정한 데로 접속을 하는데 안되는겁니다...

근데 왜 안되는지 모르겟네요...

user-service project에 application.yml 파일 설정도 동일하게 해준거 같은데

 

애초에 비밀번호가 맞고 안맞고를 떠나서 not found 가 떠버리는데... 무엇을 놓친지 모르겟습니다.

 

server:
  port: 0
spring:
  config:
    import:
      - classpath:/bootstrap.yml
  application:
    name: user-service
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest
  h2:
    console:
      enabled: true
      settings:
        web-allow-others: true
      path: /h2-console
  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:testdb
    username: sa
    password:
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    open-in-view: false
    hibernate:
      ddl-auto: create-drop
    properties:
      hibernate:
#        show_sql: true
        format_sql: true
eureka:
  instance:
    instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://127.0.0.1:8761/eureka

greeting:
  message: Welcome to the Simple E-commerce.

logging:
  level:
    com.example.userservice.client: DEBUG

management:
  endpoints:
    web:
      exposure:
        include: refresh, health, beans, busrefresh

#token:
#  expiration_time: 86400000
#  secret: user_token

답변 1

답변을 작성해보세요.

1

안녕하세요, 이도원입니다.

1) pom.xml 파일에 설정하신 h2의 버전을 확인해 보시기 바랍니다. 강의에 사용한 버전 h2 1.3.176이었습니다.

2) h2를 최신거로 사용하신 경우에는 아래의 설정과 pom.xml 파일에 내용을 확인하시고 추가해 보시기 바랍니다.

spring:
  h2:
    console:
      enabled: true
      settings:
        web-allow-others: true
      path: /h2-console
  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:testdb
    username: sa
    password:
    generate-unique-name: false
    name: testdb
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

감사합니다.

채널톡 아이콘