Giter Site home page Giter Site logo

spring-boot-210523's People

Contributors

binchoo avatar

Watchers

James Cloos avatar  avatar

spring-boot-210523's Issues

[요약] Spring의 경로 Resolution

챕터: #11

스태틱 파일들 경로와 URL 매핑

resources/static 아래에 스태틱 파일들을 몰아 넣어두면 오른편과 같이 URL 매핑이 정해진다.

  • src/main/resources/static/js/.. : http://도메인/js/..
  • src/main/resources/static/css/.. : http://도메인/css/..
  • src/main/resources/static/image/.. : http://도메인/image/..

[런타임 오류] ASM ClassReader failed to parse class file

챕터: #2

[런타임 익셉션]
[Exception] ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet

[이슈 원인]
본인 JDK 버전이 높아 저자가 사용하는 스프링 버전(2.1.7.RELEASE)과 호환되지 않음.

[큰 그림] 챕터 3에서 배우는 클래스 간 의존 관계

챕터: #6

롬복 인터페이스 때문에 너저분하지만,
생성자가 빈 주입을 위한 주요 테크닉으로 소개되었으므로, 이번 챕터까지만 롬복 인터페이스를 표기한다.

의존성의 방향이 잘 보인다: 레이어드 아키텍처에 맞추어 유저 단부터 DB 단으로 메시지가 흐른다. 코드를 짜보면서 레이어 별로 책임이 명확히 식별되어 편하다고 느꼈다.
사용되는 어노테이션들이 꽤 많으나, 그림으로 사용처와 함께 표시하니 용례를 외우기 어렵지 않았다.

[아키텍처]
image

[큰 그림] 챕터 5에서 배우는 클래스 간 의존 관계

챕터: #12

스프링 시큐리티의 클래스들을 가져다가 OAuth2 설정 및 유저 로그인 서비스를 구현해 보면서
파악한 의존관계를 나타내 보았다.

다이어그램

image

해설: 시큐리티 설정

  1. WebSecurityConfigureAdapter + @EnableWebSecurity 를 구현하여 서버 보안을 설정함.
  2. WebSecurityConfigureAdapter.configure() 메서드에서 HttpSecurity에 대해 설정을 주면 된다.
  3. 유저 로그인 시 수행할 서비스는 httpSecurity.oauth2Login().userInfoEndpoint().userService(customOAuth2UserService)처럼 명시한다.

해설: 구현하는 로그인 서비스의 정책

  1. 로그인 서비스는, 로그인에 성공한 유저 정보를 반환한다.
    이 정보는 기본적인 정보에 OAuth2 제공자의 식별자를 덧붙인 버전이다. 추가된 사항은 attributes 해시 테이블에서도 추가하여 관리해야 한다. DefaultOAuth2User 생성자는 attributes 해시 테이블, 유저 롤 그리고 유저 이름 접근키를 요구하고 있다.
return new DefaultOAuth2User(
  Collections.singleton(new SimpleGrantedAuthority(user.getRoleKey())),
  attributes.getAttributes(),
  attributes.getNameAttributeKey());

DefaultOAuth2UserService에 위임하여 기본적인 DefaultOAuth2User 정보를 얻자. 여기서 획득한 attributes를 확장하되, 필요한 OAuth2 제공자의 식별자유저 이름 접근키는 로그인 요청 OAuth2UserRequest를 분석하여 얻으면 된다.

  1. 한 편, UserRepository를 사용해 로그인한 유저 정보를 저장한다.
    • 이미 동일한 이메일이 레포지토리에 존재하면, 이름과 사진 값만 갱신해 준다.
    • 동일 유저 이메일이 없다면, 처음 로그인한 유저이므로 레포지토리에 새로이 저장한다.
  2. 한 편, HttpSessionuser 속성으로 SessionUser 객체를 지정한다.

[런타임 오류] 'ClientRegistrationRepository' that could not be found.

챕터: #12

[이슈 내용]
Application 실행 시, ClientRegistrationRepository 빈 주입을 받을 수 없다고 함.

***************************
APPLICATION FAILED TO START
***************************

Description:

Method springSecurityFilterChain in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration required a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' in your configuration.


> Task :Application.main() FAILED

Execution failed for task ':Application.main()'.
> Process 'command 'C:/Program Files/Java/jdk-13.0.2/bin/java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

[이슈 원인]
의심: .gitignore에 의해 application-oauth.properties가 지금 컴퓨터에 없기 때문에?

챕터3. ORM 사용하기 (Spring Data JPA)

JPA 는 표준 인터페이스, 표준 명세서이다.
이것의 구현체는 Hibernate, EclipseLink 등이 있으며
스프링에서는 구현체를 더 추상화 시킨 Spring Data JPA를 사용한다.
Why?

  • 구현체의 교체가 용이하니까
  • 저장소의 교체가 용이하니까

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.