패키지를 만들 땐 처음에 만든 패키지 이하에 새 패키지를 만들어 줘야 함
ex) com.cos.blog를 처음에 만들고 시작했으니
com.cos.blog.test (O)
com.cos.test (X)
스프링이 com.cos.blog 패키지 이하를 스캔해서 모든 파일을 메모리에 new 하는 것이 아니라
특정 어노테이션이 붙어 있는 클래스 파일들을 new해서(IoC) 스프링 컨테이너에 관리해준다.
failed to configure a datasource: 'url' attribute is not specified and no embedded datasource could be configured.
에러 났었는데 일단 강의 보고
1. pom.xml에서 jpa 디펜던시 주석 처리 함
근데 해결 안 됨 그래서
이래도 해결 안 돼서 끄고 낼 다시 해야지 하고 강제종료 했다 다시 들어갔는데 해결 됐다..
뭘로 해결 된 건진 잘 모르겠음
어쨌든 저 에러가 db연결이 안 돼서 나온 거란 건 알게 됐다.
그리고 에러 자꾸 해결 안 될 때 걍 강제종료 해보기;; 역시 만병통치약 강제종료 재부팅
https://getinthere.tistory.com/17
root 커넥션 만들어 주기
!! command + enter 누르면 쿼리 실행 되는데
커서가 있는 한 줄만 실행 되는 거다
모든 쿼리 실행시키는 건 shift + command + enter
ㅇㄴ 어쩐지 데이터베이스만 만들어졌더라;;
/opt/homebrew/etc/my.cnf
경로로 들어가기
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
# jsp blog 한글 설정
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
init_connect='SET collation_connection = utf8_general_ci'
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
jpa, mysql dependency 주석 해놨던 것 다시 풀기
그럼 에러나는데 MySQL 이랑 스프링 연결을 해줘야 해서 그럼
application.properties
-> application.yml
로 파일 확장자 바꾸기
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/blog?serverTimezone=Asia/Seoul
username: cos
password: cos12345