본문 바로가기

Programming

[SpringBoot] 포스트맨 실행 시 에러 Error: Exceeded maxRedirects. Probably stuck in a redirect loop 현재 상황 - 인증, 인가 관련 예외 처리를 진행하던 중, AuthenticationEntryPoint에서 응답을 주기 위해서 redirect를 하고 있었다. - 흐름은 AuthenticationEntryPoint -> sendRedirect("/exception/**") -> ExceptionController에서 throw new CustomException -> ControllerAdvice에서 해당 exception에 대한 예외 처리 - 그러나 해당 response가 Controller까지 도달하지 못하고 계속 요청이 동작하지 않는다. - 프로젝트에는 스프링 시큐리티가 적용되어 있다. 문제 Could not get response Error: Exceeded maxRedirects. Probabl.. 더보기
[mysql] 비밀번호 분실 했을때 초기화 (8.0버전) mysql uroot -p 를 통해 접속하려는데 비밀번호가 틀리다고 접속이 안된다. 비밀번호를 재설정하자. 1. 작업관리자에서 mysql 혹은 mysqld를 종료 2. MySQL이 설치된 경로로 이동 관리자 권한으로 cmd를 실행한다. where mysql 를 입력하면 mysql이 설치된 경로를 알아낼 수 있다. 이렇게 mysql이 저장된 경로를 받아온 뒤(전체 경로에서 mysql.exe를 빼야 한다.) cd [경로]를 입력하여 해당 경로로 이동한다. 3. 이동한 경로에서 mysqld.exe --skip-grant-tables --console --shared-memory를 입력 이 때 Can't create test file 에러가 발생했다.(일반적으로 발생하지 않는듯 하다.) 이런 에러가 발생할 경우.. 더보기
[SpringBoot] html페이지에서 Json 값을 객체로 받아올때 주의사항 model public class Star { String name; int age; public Star(String name, int age) { this.name = name; this.age = age; } } controller // [Request sample] // POST http://localhost:8080/hello/request/form/json // Header // Content type: application/json // Body // {"name":"Robbie","age":"95"} @PostMapping("/form/json") @ResponseBody public String helloPostRequestJson(@RequestBody Star star) { retur.. 더보기
[SpringBoot] @ModelAttribute 값받을때 null값 나오는 현상 model public class Star { String name; int age; public Star(String name, int age) { this.name = name; this.age = age; } } 괄호(String name, int age)가 있는 생성자로 만들고 Controller // [Request sample] // POST http://localhost:8080/hello/request/form/model // Header // Content type: application/x-www-form-urlencoded // Body // name=Robbie&age=95 @PostMapping("/form/model") @ResponseBody public String hello.. 더보기
[Thymeleaf] SpringBoot에 Thymeleaf 적용하기 기존에 JSP환경에서 뷰를 제작하다가 한계를 느껴 다른 템플릿을 적용해보기로 마음을 먹었다. 스프링이 지원해주는 템플릿 엔진을 알아보던 중 FreeMarker Groovy Thymeleaf Mustache 이렇게 4개가 있다는 것을 알게되었는데 그 중에 스프링이 지원해준다는 Thymeleaf(타임리프)를 적용해 보기로 하였다. (사실 처음엔 가장 성능 좋다는 Freemarker를 선택했는데 SpringSecurity프레임 워크를 적용하던 중 막혀서 결국 Thymeleaf를 선택하게 되었다. Freemarker로 SpringSecurity를 적용하려면 JSTL을 별도로 또 사용해야 한다는 의견이 있어서 SpringSecurity까지 사용해야 하는 내 경우에는 타임리프가 낫다는 판단이 들었다.) 1. Bui.. 더보기
[SpringBoot] Spring 프로젝트에서 Thymeleaf 기본 설정하는 방법 먼저, thymeleaf를 설정하는 방법을 소개 한 후, thymeleaf 설정 후 css도 설정하는 방법을 알려드리겠습니다. Thymeleaf 설정하는 방법 STEP 1. build/gradle 파일 설정 아래와 같이 thymeleaf 관련 dependency를 추가합니다. .. dependencies { .. implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation('nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect') }Copy STEP 2. application.properties 설정 아래의 4줄을 추가합니다. spring.thymeleaf.cache=false.. 더보기
[mysql] DBeaver 에서 MySQL 연결 시 "Public Key Retrieval is not allowed" 해결하기 Docker로 MySQL Container 를 띄우고, DBeaver로 Connect 하려고하는데 Public Key Retrieval is not allowed 문구가 보이면서, 연결에 실패한다. 검색해보니 MySQL 8.0 이상부터 생길 수 있는 문제라고 한다. 이럴 때는 Driver properties 에 추가 정보를 제시하면 된다. 아래 그림대로 쭉쭉 따라가면 해결될 것이다. 🍀 방법1 connect to a database 창에서 Driver properties 탭을 클릭 화면에 마우스 오른쪽 클릭 후, Add new property 를 클릭 프로퍼티 값을 위 그림 처럼 추가해준다. allowPublicKeyRetrieval=true useSSL=false 참고: 위 그림처럼 화면이 안 나오면?.. 더보기
파이썬 실행 중 File "<stdin>", line 1 SyntaxError: invalid syntax 에러 해결 방법 html 코딩연습을 하는 와중에 처음에는 되다가 코딩을 하고 웹페이지 확인을 위해서 액션을 눌러서 디버깅하려고 하는데 지속적인 File "", line 1 SyntaxError: invalid syntax오류 코드가 나와서 어리둥절하고 있었다. SyntaxError: invalid syntax >>> C:/Users/User/anaconda3/python.exe c:/Users/User/homepage/templastes/views.py File "", line 1 C:/Users/User/anaconda3/python.exe c:/Users/User/homepage/templastes/views.py ^ SyntaxError: invalid syntax >>> 그러면 exit() 를 입력하거나 컨트롤 .. 더보기
[Android]카드게임만들기_프로젝트 셋팅 및 구글로그인 1. 프로젝트 생성 2. 테스트 가상 기기 생성 필자는 Q Api를 선택하고 기기는 Pixel 5를 선택하였습니다. 3. 구글 로그인 - 구글 firebase 접속 후 프로젝트 생성 Android 패키지 이름에는 AndroidManifest.xml의 안의 Android 패키지 이름을 작성한다. 앱 닉네임은 말 그대로 앱을 구분할 수 있는 닉네임을 입력하면 된다. 디버그 서명 인증서 SHA-1은 Google 로그인 과정에서는 선택사항이 아닌 필수사항이다. 이후 파이어베이스 공식 레퍼런스를 참고하여 구글로그인 소스코드를 작성할 것 -- sha-1 키 등록 방법 1) cmd에서 keytool을 사용한다. [mac] keytool -list -v -alias androiddebugkey -keystore ~/... 더보기
[ANDROID] ANDROID12(targetSdk 31)버전으로 앱실 행 시, android:exported 설정 android12를 타겟팅해야하는 경우, AndroidManifest.xml 파일에서 activities, services, receivers 등에 android:exported 를 설정해야한다. 해당코드에서 android:exported="true" 속성이 없으면 Manifest merger failed : android:exported needs to be explicitly specified for element . Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defi.. 더보기