안녕하세요 선생님🙇♀️ 클래스_메소드 강의를 보다 궁금한 점이 생겨 질문 남깁니다. BlockBox 클래스에 두 메소드를 넣었고, 04_Method클래스에 두 메소드를 활용한 문장이 있었는데요. insertMemoryCard()는 그대로 사용했지만, getVideoFileCount()는 다시 변수로 선언한 이유가 무엇인가요? 감사합니다. void inserMemoryCard(int capacity) { System.out.println("메모리 카드가 삽입되었습니다."); System.out.println("용량은 " + capacity + "GB 입니다."); } void getVideoFileCount(int type) { if ( type == 1) { return 9; } else if ( type == 2) { return 1; } return 10; } b1.insertMemoryCard(256); int fileCount = b1.getVideoFileCount(1);
안녕하세요 강의 잘 보고있습니다. csrf 토큰 값을 헤더에 넣어서 실습하는 부분 따라해봤는데 잘 안되서 코드를 뜯어봤습니다. 이번에 시큐리티 버전이 6으로 올라가면서 csrf 토큰을 인코딩해서 전달하고 이걸 디코딩하는 부분이 영상과 다른것같았습니다. 그래서 기본으로 제공하는 로그인 페이지에서 디버깅을 해보았는데 클라이언트에 전달한 csrf 토큰값이랑 실제 서버가 가지는 csrf 토큰값이 서로 달랐습니다. 이렇게되면 영상에서 보여주신 실습은 제대로 동작하지 않는게 맞나요? 해당 사진은 CsrfFilter에서 actualToken을 받아오기 위한XorCsrfTokenRequestAttributeHandler 클래스 내부에 존재하는 resolveCsrfTokenValue 함수의 소스코드입니다. 예제 따라하면 항상 마지막에 사이즈 비교하는 부분에서 걸렸습니다.
안녕하세요. 모임 만들기 페이지에서 시간을 설정할 때, 연월일 제외하고 시간만 입력하려면 어떻게 하면 되는지요? fragments.html 의 <div th:fragment="event-form (mode, action)"> 에서 <input id="endEnrollmentDateTime" type="datetime-local" 의 type 부분을 type="time" 으로 하고 Event 클래스에서 private LocalDateTime endEnrollmentDateTime; 을 private DateTime endEnrollmentDateTime; 로 변경하고 실행하면 html 상에서는 시간이 입력되나, DB 에는 insert 되어 있지 않습니다. 어떻게 하면 가능한지요? 자세한 설명 부탁드립니다. 그리고, 제공해 주신 소스를 다운로드해서 프로젝트를 실행한 후, 오른쪽 드롭다운 메뉴 중 스터디를 클릭해도 아무 동작이 일어나지 않습니다. 소스를 보면 <a class="dropdown-item" >스터디</a> 이렇게만 나와있고 th:href="@{}" 로 연결된 페이지가 없습니다. 이 부분 기능 구현은 안 해 놓으신 건지요? 프로필 페이지에서도 왼쪽 프로필 사진 밑에 있는 스터디 버튼을 누르면 Study 라고만 나오고 별다른 페이지가 나오지 않습니다. 이 부분도 기능 구현은 안 해 놓으신 건지요?
혹시 Flex-direction: row이고, Flex-wrap이 Wrap으로 설정되어 있고, 아이템들은 width: 33.3333%의 크기를 가지며, Height들은 서로서로 다 다를때, Wrap되어 행이 2개가 생길때에 Flex-grow가 1로 Item들에 설정되어 있다면 모든 행의 높이가 가장 큰 높이에 맞춰지게 되는데요. https://blogpack.tistory.com/863 여기나 이 강의에서 학습한 대로 1행에서는 flex-grow의 이해가 쉽게 됬습니다. 그치만, 제가 언급한 지금 이 예처럼 2열이고 높이가 서로다른 3개의 아이템들일 경우에는 Flex-grow가 한 행의 영역에서 남은 여백을 참조하여 모든 높이를 최대까지 늘리는 것인가요? flex-grow 또는 flex-shrink가 적용되는 영역은 한 행이나 열에서 적용되나요? 각각의 Item들에 적용하는 속성이니 이해가 조금 어렵네요... 많은 조언 부탁드립니다.
안녕하세요 영한님! 질문드립니다. 고아 객체는 부모 엔티티와 연관관계가 끊어진 자식 엔티티 라고 이해했습니다. 고아 객체가 생성되는 조건은 부모 엔티티 삭제 부모 엔티티가 삭제 되면 자식 엔티티를 고아객체로 판단 합니다. e.g) em.remove(parent); 부모 엔티티에 있는 자식 엔티티 컬렉션 제거 연관관계가 끊어진 자식 객체를 고아객체로 판단 합니다. e.g) parent.getChild().remove(0); 결과적으로 orphanRemoval = true 를 설정하면 자식 엔티티(고아 객체)는 부모 엔티티와 함께 삭제 되거나 자식 엔티티(고아 객체)만 삭제 된다. 맞게 이해하고 있는 것 일까요? 감사합니다.^^
1. 질문은 문제 상황을 최대한 표현해주세요. postman 에서 send 버튼을 누르면 아래와 같이 invalid URL 오류가 뜹니다. 어느 부분이 잘못된 걸까요?ㅠㅠ 2. 구체적이고 최대한 맥락을 알려줄 수 있도록 질문을 남겨 주실수록 좋습니다. 그렇지 않으면 답변을 얻는데 시간이 오래걸릴 수 있습니다 ㅠㅠ 구글에 검색해봤는데 해결책이 딱히 나오지 않았어요 3. 먼저 유사한 질문이 있었는지 꼭 검색해주세요!
안녕하세요 선생님, 다름이 아니라 제가 지난 String[], String, charAt, length와 관련된 질문 이후로 문자열(String)을 계속 공부하면서 막히는 것이 조금 있어 이렇게 질문을 남깁니다. 아래 코드에서 제가 간단하게 System.out.println(); 명령문으로 아래 문장들을 출력해봤습니다: 결과 (1)에서는 "Hello, "와 "World!" 2개의 단어가 합쳐져서 문장 Hello, World!가 출력이 되고, 결과 (2)에서는 Route 12가 아닌, Route 66으로, 결과 (3)에서는 25 years old 이라고 출력이 되는데, 이렇게 되는 이유가 System.out.println(); 명령문의 괄호 안에 쓰여진 문장들이 기본적으로 String으로 간주하여 결과를 출력하고, 만일 숫자가 먼저 온다면 int로 인지해서 결과를 먼저 받은 다음, + 기호를 통해 문자열을 출력해서 그런 건가요? 혹여나 시간이 되신다면, 선생님으로부터 답변을 받았으면 좋겠습니다! 지난 번 QNA가 너무 좋아서 아직도 기억에 남네요..ㅎ 미리 감사합니다 :)
Spring Authorization 1.0 을 사용하여 FormLogin 이 아닌 Ajax로 로그인을 하려고 합니다. Spring Security 강의를 참조하여 AbstractAuthenticationProcessingFilter를 상속하여 CustomUserDetailsService, CustomAuthenticationProvider, CustomAuthenticationProcessingFilter, CustomAuthenticationToken 구현체를 만들었습니다. CustomAuthenticationProcessingFilter는 AbstractAuthenticationProcessingFilter 상속하여 개발하였는데 Filter를 등록 하려면 강의에서 내용처럼 AuthenticationManager를 등록 해줘여 하는데 강의는 WebSecurityConfigurerAdapter 상속하여 설정 하는것으로 설명되어 있는데 Spring Securitty 6.0 에서는 삭제되었습니다. Spring Security 의 강의를 보면 @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(ajaxAuthenticationProvider()); } configure(AuthenticationManagerBuilder auth)를 구현하고 @Bean public AjaxLoginProcessingFilter ajaxLoginProcessingFilter() throws Exception { AjaxLoginProcessingFilter filter = new AjaxLoginProcessingFilter(); filter.setAuthenticationManager(authenticationManagerBean()); return filter; } 질문)AjaxLoginProcessingFilter Bean 에서 설정하는데 SecurityFilterChain 를 등록하는 방식에서는 어떻게 등록해야 할지 문의 합니다. 제가 구현한 소스 일부 Authorization Server 설정을 다른 클래스에서 설정하였고 디버깅을 해보니 Authorization Server 용 FilterChain 과 로그인 처리용 FilterChain 이 따로 등록되어 로그인 프로세스는 Spring Security FilterChain Class 에서 진행하였습니다 @Configuration는 Spring Security 6에서는 @EnableWebSecurity에 포함되지 않아 추가 하였습니다. @EnableWebSecurity @RequiredArgsConstructor @Configuration public class DefaultSecurityConfig { private final PasswordEncoder passwordEncoder; private final CustomAuthenticationProvider customAuthenticationProvider; // @Bean public CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter() throws Exception { CustomAuthenticationProcessingFilter filter = new CustomAuthenticationProcessingFilter(); return filter; } // @formatter:off @Bean SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception { http .authorizeHttpRequests(authorizeRequests ->authorizeRequests .requestMatchers(CorsUtils::isPreFlightRequest).permitAll() .requestMatchers("/login/**").permitAll() .requestMatchers("/api/registered-client/**").permitAll() .anyRequest().authenticated() ) .csrf(csrf -> csrf .ignoringRequestMatchers(new AntPathRequestMatcher("/api/registered-client/**")) ) .formLogin().disable(); http.authenticationProvider(customAuthenticationProvider); http.addFilterBefore(customAuthenticationProcessingFilter(), UsernamePasswordAuthenticationFilter.class); return http.build(); } // @formatter:on } AuthenticationManager를 등록하지 않아 예와가 발생함 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customAuthenticationProcessingFilter' defined in class path resource [com/naon/oidc/security/config/DefaultSecurityConfig.class]: authenticationManager must be specified 그리고 @Bean으로 만들어 등록하면 순환참조가 됩니다.
폼 객체를 이렇게 이해한 것이 맞는지 !! @GetMapping("/members/new") public String createForm(Model model) { model.addAttribute("memberForm",new MemberForm()); return "members/createMemberForm"; } GET 요청시 비어있는 MemberForm 객체를 모델에 담아서 뷰(템플릿)에 전달 @PostMapping("/members/new") public String create(@Valid MemberForm form , BindingResult result) { 클라이언트가 폼에 작성한 필드들을 Submit 할때 POST 요청되어 템플릿에서 각 필드의 값들을 컨트롤러에서 넘겨준 모델의 form 객체에 set 한다 Address address = new Address(form.getCity(), form.getStreet(), form.getZipcode()); Member member = new Member(); member.setName(form.getName()); member.setAddress(address); memberService.join(member); form 객체는 이제 값이 설정되었으니 Member 객체를 생성하고 이 member 의 필드들을 form 객체에서 가져와서 set 하고 join(회원가입)을 완료한다 . 강의에서 말하는 폼 객체 vs 엔티티 직접 사용 지금은 서비스가 작아서 폼 객체를 사용하는 것이 더 번거러운 일인듯 한데 더 복잡해지면 엔티티를 유지보수하기 어려워지기 떄문에 엔티티는 화면을 위한 로직은 없어야 한다. 항상 친절한 답변 주셔서 감사합니다 !