web / jdbc / devtools 빌드해서 실행하면 항상
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
이런 에러가 난다. 이것은 JDBC를 썼기 때문에 DB를 연동해줘야하는 것으로 생각된다.
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=
spring.datasource.password=
logging.level.sql=debug

@SpringBootApplication 이 붙은 이 클래스랑 같은 패키지 안에 있는 것들만 bean으로 등록을 해준다고 K교수님이 알려주셨다. @RestController
public class OauthController {
...
@GetMapping("/login/oauth2/code/github")
public String code(String code) {
...
return "hello"
}
}

http://localhost:8080/login/oauth2/code/github?code=xxx 이런식으로 code 값이 넘어오는 상황에서 이를 받고 싶었다.
처음에는 이런식으로 code를 작성했으나
이렇게 제거 했을 때에도 똑같이 작동했다. application-github.properties 라는 파일을 따로 만들어 관련 정보를 저장했다.

application.proeprties에 include를 해 주었다. 


git rm --cached 파일명
git rm --cached -f 파일명



간단하게 해당 링크로 이동할 수 있게 했다. 


이렇게 포함하라고 가이드가 있어서 헤더에 위 내용도 포함해줬다.


package com.bongf.oauthPractice;
import com.fasterxml.jackson.annotation.JsonProperty;
public class OAuthToken {
private String accesToken;
private String tokenType;
private String scope;
private String bearer;
@JsonProperty("access_token")
public void setAccesToken(String accesToken) {
this.accesToken = accesToken;
}
@JsonProperty("token_type")
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public void setScope(String scope) {
this.scope = scope;
}
public void setBearer(String bearer) {
this.bearer = bearer;
}
public String getAccesToken() {
return accesToken;
}
public String getTokenType() {
return tokenType;
}
public String getScope() {
return scope;
}
public String getBearer() {
return bearer;
}
}





객체로 바로 받은 다음에 getBody()를 해줘도 똑같이 작동한다 


공식문서

requestdto도 만들어 줬다.
확인해보니 정상적으로 동작한다 
이렇게 변경해주니 정상동작한다. 훨씬 깔끔하다. 
