본문 바로가기

전체 글

(48)
스프링 부트 3 백엔드 개발자 되기_27 지난번에 떴었던 오류 2023-09-08T08:21:32.558+09:00 WARN 31308 --- [nio-8080-exec-6] OAuth2AuthorizationRequestRedirectFilter : Authorization Request failed: org.springframework.security.oauth2.client.web.InvalidClientRegistrationIdException: Invalid Client Registration with Id: goole org.springframework.security.oauth2.client.web.InvalidClientRegistrationIdException: Invalid Client Registration with Id: ..
스프링 부트 3 백엔드 개발자 되기_26 기존 application.yml 파일 spring: jpa: #전송 쿼리 확인 show-sql: true properties: hibernate: format_sql: true defer-datasource-initialization: true datasource: url: jdbc:h2:mem:testdb username: sa h2: console: enabled: true jwt: issuer: ajufresh@gmail.com secret_key: study-springboot security: oauth2: client: registration: google: client-id: client-secret: scope: - email - profile 을 spring: security: oaut..
스프링 부트 3 백엔드 개발자 되기_25 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Bean method 'tokenAuthentication' must not be private or final; change the method's modifiers to continue Offending resource: class path resource [me/shinsunyoung/springbootdeveloper/config/WebOAuthSecurityConfig.class] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailF..
스프링 부트 3 백엔드 개발자 되기_24 어제 안됐던 AddArticleRequest 클래스 toEntity 부분 Article 클래스에서 뭐 잘못작성한거 같아서 보니까 Article에 @Builder를 두개 쓰고 있길래 하나 지웠더니 잘 적용이 됨 Article클래스에 ################Article클래스에 작성한 두개################### @Builder public Article(String title, String content) { this.title = title; this.content = content; } @Builder public Article(String author, String title, String content){ this.author = author; this.title = title; t..
자바의 신3장_직접해봅시다 public class Profile { String name; int age; public void setName(String str) { name = str; } public void setAge(int val) { age = val; } public void printName() { System.out.println("My name is "+name); } public void printAge() { System.out.println("My age is "+age); } public static void main(String[] args) { Profile profile = new Profile(); profile.setName("Min"); profile.setAge(20); profile.pri..
스프링 부트 3 백엔드 개발자 되기_23 @NoArgsConstructor //기본 생성자 추가 @AllArgsConstructor //모든 필드 값을 파라미터로 받는 생성자 추가 @Getter public class AddArticleRequest { //private String id; private String title; private String content; public Article toEntity(String author){ //생성자를 사용해 객체 생성 return Article.builder() .title(title) .content(content) .author(author) //여기서 에러남 .build(); } } Cannot resolve method 'author' in 'ArticleBuilder' No cand..
자바의 신 1권 2,3장 main 메소드 실행을 목적으로 하는 모든 자바 클래스는 main() 메소드가 반드시 있어야 한다 java 명령으로 실행하는 자바 프로그램의 진입점(시작점)은 main() 메소드이기 때문에 반드시 있어야 함 자바 기반으로 실행되는 모든 프로그램에는 수많은 클래스 중 적어도 하나의 main메소드가 있는 클래스가 있고 그 메소드가 수행되는 것 그리고 그 메소드는 반드시 아래와 같이 선언되어야 한다 public String void main(String[] args) { } *메소드를 static으로 선언하면 객체를 생성하지 않아도 호출할 수 있다 *args는 매개 변수의 이름인데 main메소드 중에서 유일하게 바꿔도 되는 것이 이 args라는 매개 변수 이름이다 public class Calculator {..
스프링 부트 3 백엔드 개발자 되기_22 OAuth2와 JWT를 함께 사용하려면 기존 스프링 시큐리티를 구현하며 작성한 설정이 아니라 다른 설정을 사용해야함 config 패키지 WebOAuthSecurityConfig 클래스 1.filterChain() 메서드 : 토큰 방식으로 인증해서 기존 폼 로그인, 세션 기능을 비활성화함 2.addFilterBefore() 헤더값 확인용 커스텀 필터 추가 : 헤더 값을 확인할 커스텀 필터를 추가, 이필터는 9.2.4 '토큰 필터 구현하기'에서 구현한 TokenAuthenticationFilter클래스임 3.authorizeReauests()메서드 URL 인증 설정 : 토큰 재발급 URL은 인증 없이 접근하도록 설정하고 나머지 API들은 모두 인증을 해야 접근하도록 설정 4,5 oauth2Login()메서드..