- nginx
- spring
- jpa
- springboot
- Docker
- join
- ci/cd
- spring security 6
- 스프링
- PYTHON
- java
- spring boot
- mysql
- 자바
- select
- SSL
- Django
- @transactional
- spring mvc
- 데이터베이스
- sql
- 문자열
- 1차원 배열
- ORM
- string
- 스프링부트
- CloudWatch
- AWS
- hibernate
- 프로그래머스
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
목록전체 글 (198)
개발하는 자몽
오류 질문을 받았는데, 내가 지난번에 겪었던 에러와 유사한 것 같아서 정리해두려고 한다. 상황 API에 요청을 하고 해당 정보를 DB에 담는 것까지는 에러 없이 진행이 된다. 하지만 저장한 정보를 조회하면 아래와 같은 에러가 콘솔창에 나타난다. Postman에서는 500 에러라고 알려준다. (오류 전문이 아닌 중요한 부분만 가져왔다) 2023-02-13T09:52:21.966+09:00 ERROR 71150 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request process..
Backend Architecture - AWS EC2 진입 - Nginx 진입 - Nginx는 실제로 하나지만, 기능 및 아키텍처 이해를 돕기 위해 순서를 나눴다 : 로드 밸런싱, 웹서버(view) 기능, 리버스 프록시/포트 포워딩 기능 - Nginx의 기능을 나누지 않고 하나로 썼을 때는 말 그대로 하나로 보면 된다. - AWS S3는 사진/동영상 업로드 용으로 사용 큰 틀 ▷ IDE ↔ Gitlab CI/CD ↔ Gradle(build) ↔ Docker(deploy) ↔ Nginx(Web Server) ↔ SpringBoot(WAS) ↔ JPA ↔ MySQL(DB, AWS RDS) DB ▷ RDS를 사용한다면 EC2 밖, 사용하지 않고 EC2 내부에 설치할 경우 똑같이 배경색을 칠하는 것으로 생각한..
동기, 비동기에 대해 막연하게만 알고 있다는 생각이 들어 정리하게 되었다. 첫 부분은 아래 글을 번역하고, 번역글 아래에는 여러 자료를 찾으면서 이해한 내용을 정리해 보자. Synchronous vs Asynchronous Next: Buffering of Messages Up: Message Passing Previous: Remote Assignment vs Procedure The send, receive, and reply operations may be synchronous or asynchronous. A synchronous operation blocks a process till the operation completes. An asynchronous oper www.cs.unc.edu 1..
상황 서버를 켜고 질문 등록을 해보는데 500 에러가 발생했다. 혹시나 해서 답변 등록도 해봤는데 똑같이 500 에러가 발생했다. 이 에러는 서버의 문제라서 바로 콘솔창에서 에러를 확인했다. 연관 관계 ERD에 다른 필드는 적지 않고 PK와 FK만 작성했다. 발생한 에러와 원인 고찰 JdbcSQLIntegrityConstraintViolationException: Referential integrity constraint violation 오류 내용을 보면 Referential integrity constraint violation(참조 무결성 제약 조건 위반)이 발생함을 알 수 있다. 참조 무결성 제약 조건을 위반했다고 나오니 의심 가는 부분은 @ManyToOne을 적용한 FK 뿐이었다. 오류가 난 h..
스프링 시큐리티 인증을 받은 로그인한 사용자의 정보를 타임리프에서 사용하고 싶을 때 사용한다. 공식 문서 Thymeleaf + Spring Security integration basics - ThymeleafHave you switched to Thymeleaf but your login and error pages are still using JSP? In this article we will see how to configure your Spring application to use Thymeleaf for login and error pages. All the code seen here comes from a working application. Youwww.thymeleaf.org build...
권한에 따른 페이지처리를 하고 싶다면 Principal 객체를 사용하는 메서드 위에 @PreAuthorize("isAuthenticated()") 어노테이션을 사용하면 된다. Principal 객체를 사용하는 메소드에서 사용하지 않으면 500 에러가 발생한다. 이 오류는 Principal 객체가 널(null)값이라서 발생한 오류이다(콘솔을 확인하면 NPE가 반겨줄거다). Principal 객체는 로그인을 해야만 생성되는 객체이기 때문이다. ▶ isAuthenticated() : 로그인 → true | 로그아웃 → false 나의 경우 "로그인을 해야 게시글 또는 댓글을 달 수 있게 하고, 로그아웃 상태라면 로그인 페이지로 이동"하게 하고싶었다. 해당 따라서 해당 어노테이션을 적용하여 메서드가 실행되기 전..
GrantedAuthority 스프링 공식문서는 GrantedAuthority를 아래와 같이 설명하고 있다. Represents an authority granted to an Authentication object (이 글의 Authentication은 인터페이스이다. AuthenticationManager.authenticate 메소드에서 요청을 처리한 후 authenticated principal 또는 인증 요청에 대한 토큰을 나타낸다. (나는 '나타낸다'로 하면 헷갈려서 '토큰의 정보를 갖고있다'로 해석한다)) GrantedAuthority는 인터페이스로 Authentication에 부여한 권한을 나타낸다. Authentication에는 User(사용자)정보가 있어야 한다. 그리고 User 객체의..
UserDetailsService UserSecurityService는 스프링 시큐리티 설정에 등록할 클래스이다. 이 클래스는 스프링 시큐리티 로그인 처리의 핵심 부분이다. @RequiredArgsConstructor @Service public class UserSecurityService implements UserDetailsService { private final UserRepository userRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { Optional userOptional = userRepository.findByUsername(use..
BCryptPasswordEncoder는 BCrypt 해싱함수(BCrypt Hashing Function)를 사용해서 비밀번호를 암호화(encode)한다. 아래 코드는 값을 받아서 사용자를 생성한다. 이때 비밀번호는 BCryptPasswordEncoder를 사용하여 암호화하고 DB에 저장한다. @RequiredArgsConstructor @Service public class UserService { private final UserRepository userRepository; public SiteUser create(String username, String email, String password) { BCryptPasswordEncoder encoder = new BCryptPasswordEnco..
@EnableWebSecurity? @EnableWebSecurity는 URL이 스프링 시큐리티의 제어를 받도록 만드는 어노테이션이다. @EnableWebSecurity 어노테이션을 사용하면 내부적으로 SpringSecurityFilterChain이 동작하여 URL 필터가 적용된다. 스프링 시큐리티의 세부 설정은 SecurityFilterChain 빈을 생성하여 설정할 수 있다. 공식문서에서는 아래와 같이 설명하고 있다. Add this annotation to an @Configuration class to have the Spring Security configuration defined in any WebSecurityConfigurer or more likely by exposing a Secur..