묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
대상 클래스 타입이 무엇인가요?
안녕하세요. 강의 6분35초쯤에 나오는 대상 클래스 타입이 무엇을 말하는건가요?
-
미해결재고시스템으로 알아보는 동시성이슈 해결방법
lettuce vs reddisson 실무에서 도입 시 고려하는 부분에 대해서 설명할 때 질문있습니다.
lettuce와 같은 경우는 락에 대한 재시도가 필요하지 않아도 사용하고,reddisson는 재시도가 필요한 경우 사용한다고 설명들었습니다.그런데 lettuce는 spinLock 기법으로 lock에 대해서 계속적으로 계속적으로 점유하려고 하는 방식으로 설명들었습니다.재시도가 필요하지 않는 lock이라는게, 제가 이해한 것과는 다른 내용일까요?궁금합니다!
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
[9:00] fail(); 에서 에러가 발생합니다.
아래와 같은 에러가 발생합니다.확인 한번만 부탁드립니다.(코드 추가했습니다.)
-
해결됨스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
viewResolve 실행되는 위치가 render() 안에 있는게 맞나요?
PDF를 보면서 복습을 하는데1. 핸들러어댑터호출핸들러어댑터를 통해 new-form 이라는 논리뷰 이름을 획득한다.2. ViewResolver 호출new-form 이라는뷰 이름으로 viewResolver를 순서대로호출한다.BeanNameViewResolver 는 new-form 이라는 이름의스프링 빈으로등록된 뷰를찾아야하는데 없다. InternalResourceViewResolver 가 호출된다.3. InternalResourceViewResolver이뷰 리졸버는 InternalResourceView 를반환한다.4. 뷰 - InternalResourceViewInternalResourceView 는 JSP처럼포워드 forward() 를호출해서 처리할수 있는경우에 사용한다.5. view.render()view.render() 가호출되고 InternalResourceView 는 forward() 를사용해서 JSP를실행한다.그런데 코드를 찾아보니까render()가 실행되면서 resolveViewName()로 viewResolver를 순회하던데이때 InternalResourceViewResolver가 호출되는게 맞나요 ?
-
해결됨스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
localhost:8080/hello 접속 시 Whitelabel Error Page
안녕하세요! spring 부트 3.0.3 버전에서 자바 17을 이용해서 강의 내용을 따라하는 중에 HelloServlet을 만들고 localhost:8080/hello에 접속을 시도했으나 localhost:8080페이지와 같은 Whitelabel Error Page가 뜨네요.다른 질문 들을 참고하여 @ServletComponentScan이나 세팅에서 자바로 실행하도록 설정을 변경하였으나 같은 문제가 발생합니다.도움을 주신다면 정말 감사합니다
-
미해결스프링 핵심 원리 - 기본편
getBean()의 파라미터
질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]getBean() 함수를(1번 코드)MemberService memberService = applicationContext.getBean("memberService", MemberService.class);이렇게 사용을 해주셨는데 인텔리제이에서 자동완성 기능을 사용했더니(2번 코드)MemberService memberService = applicationContext.getBean(MemberService.class);이런 식으로 나오더라구요. (1번 코드)처럼 파라미터를 두개로 사용할 때, bean 이름과 파라미터 name 값이 다르면 오류가 생겨요. 그러면 애초에 name 파라미터 값이 필요한 이유가 있는걸까요??그리고 또 궁금한 것이 (2번 코드)로 사용을 안하고 왜 (1번 코드)로 사용을 하는 것인지 궁금해요
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
ItemType[] 과 List<DeliveryCode> 의 차이
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]@ModelAttribute() 에서 regions() 는 map을 사용했고itemTpyes()는 배열을 사용했고deliveryCodes()는 리스트를 사용하셨는데 각각을 이렇게 사용하신 이유가 따로 있을까요??
-
해결됨스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
인터셉터 활용 방법 질문
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]안녕하세요. 좋은 강의 잘 듣고 있습니다. 감사합니다.다름이 아니라 제가 혼자서 토이프로젝트를 만드는중에 ADMIN / USER 권한을 분리하고 인터셉터를 통해서 권한이 없으면 /admin/**이 포함된 url에는 접근을 못하도록 코드를 구현했습니다. 포스트 맨으로 확인을 해 보았을 때, 실제로 권한이 없으면 원하는 값이 나오지 않지만 HTTP 상태코드가 200(OK)로 나옵니다. 제가 이해한게 맞다면, 인터셉터의 역할은 올바른 요청일 땐 정상 흐름으로 작동하고 잘못된 요청(return false;)일 땐 리다이렉트 처리해서 흐름을 바꿔주는(?) 것으로 알고 있습니다. 혹시 인터셉터를 통해서 상태코드도 변환할 수 있는 방법이 있는지 궁금합니다! 혹시 안된다면 다른 방법이 있는지도 궁금합니다!
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
컨트롤러를 인식 못하는거같습니다. 404에러
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)예3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)예[질문 내용]여기에 질문 내용을 남겨주세요.컨트롤러를 인식하지 못하는거같습니다 무슨 문제가있는지 궁금합니다
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
veiw spring! 가 안되요
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.
-
해결됨스프링 부트 - 핵심 원리와 활용
Tomcat에 대해 질문드립니다.
안녕하세요. 강의를 보고 궁금한 점이 생겨 질문드립니다.Java 진영에서 말하는 WAS의 정의를 보면'웹 애플리케이션 서버는 대부분이 자바 기반으로 주로 자바 EE 표준을 수용하고 있으나, 자바 기반이지만 자바 EE 표준을 따르지 않는 제품과 .NET이나 Citrix 기반인 비 자바 계열도 존재한다' 라고 설명되어있습니다.Tomcat은 아파치 재단에서 만든 웹 컨테이너(서블릿 컨테이너)만 있는 WAS라고 설명하는데웹 컨테이너만 지원하는 Tomcat을 WAS라고 할 수 있는건지 궁금합니다.
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
basename 질문드립니다.
만약 basename을 messages가 아닌 임의로 등록하게 되면 다른 언어 정보 파일들도파일명_나라명.properties로 설정하면 되나요?
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
requests.parm 이 오류나요
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]controller 에서 만들었는데이렇게 오류나는데 어떻게 해야되나요?
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
Controller를 인식하지 못하는것같습니다
새로운 프로젝트를 만들었는데 Controller를 인식하지 못해서 그런지 404 error만 나옵니다ㅜㅜ.SpringBootApplication의 하위 폴더에 Controller를 만들었고@Controller 어노테이션도 붙여줬는데인식하지 못해서 가장 기본적인 "hello"를 못찍고 있습니다ㅜㅜ. 너무 기본적인 질문인데 해결하지 못해서 올리게되었습니다.
-
해결됨스프링 핵심 원리 - 기본편
NoSuchBeanDefinitionException: No qualifying bean of type 'hello.core.member.MemberService' available 오류
질문드립니다!압축 코드 링크 : https://drive.google.com/file/d/1c30gucjwJ5fwL7lJtsSv2SR2-pWLPLbR/view?usp=sharing 자꾸 스프링 컨테이너에 bean이 등록되어 있지 않다고 오류가 뜨는데 도저히 해결 방법을 모르겠습니다. ㅠㅠ
-
미해결스프링 부트 - 핵심 원리와 활용
강의 PPT 자료 관련 문의
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]안녕하세요! 강의 잘 듣고 있습니다.다름이 아니라 올려주신 수업 자료에는 '스프링 부트 소개' 파트에서 사용하신 PPT 자료가 업로드 되어 있지 않습니다.복습을 위해 해당 자료가 있으면 좋을듯 한데, 추후 따로 업로드 해주실 수 있는지 궁금합니다.감사합니다!
-
해결됨스프링 시큐리티 OAuth2
Ajax 인증시 인가코드가 발급 되지 않는 원인 문의
Spring Authorization 1.0,1 기반으로 개발을 하고 있습니다. 인가코드를 발급 할떄 FormLogin 기본 설정을 사용하면 인가코드가 발급이 되는데 Ajax 로 로그인을 하면 인가코드가 발급되지 않고 있습니다. 디버깅을 해보면 로그인인 후 OAuth2AuthorizationEndpointFilter 는 실행되는데 @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { if (!this.authorizationEndpointMatcher.matches(request)) { filterChain.doFilter(request, response); return; } try { Authentication authentication = this.authenticationConverter.convert(request); if (authentication instanceof AbstractAuthenticationToken) { ((AbstractAuthenticationToken) authentication) .setDetails(this.authenticationDetailsSource.buildDetails(request)); } Authentication authenticationResult = this.authenticationManager.authenticate(authentication); if (!authenticationResult.isAuthenticated()) { // If the Principal (Resource Owner) is not authenticated then // pass through the chain with the expectation that the authentication process // will commence via AuthenticationEntryPoint filterChain.doFilter(request, response); return; } if (authenticationResult instanceof OAuth2AuthorizationConsentAuthenticationToken) { if (this.logger.isTraceEnabled()) { this.logger.trace("Authorization consent is required"); } sendAuthorizationConsent(request, response, (OAuth2AuthorizationCodeRequestAuthenticationToken) authentication, (OAuth2AuthorizationConsentAuthenticationToken) authenticationResult); return; } this.authenticationSuccessHandler.onAuthenticationSuccess( request, response, authenticationResult); } catch (OAuth2AuthenticationException ex) { if (this.logger.isTraceEnabled()) { this.logger.trace(LogMessage.format("Authorization request failed: %s", ex.getError()), ex); } this.authenticationFailureHandler.onAuthenticationFailure(request, response, ex); } } FormLogin 적용시에는 authenticationResult의 principal 에 UsernamePasswordAuthenticationToken이 설정되어 인가 코드가 정상적으로 발급되는데 AjaxLogin 적용시에는 authenticationResult의 principal 에 AnonymousAuthenticationToken이 설정되어 인가 코드가 정상적으로 발급되지 않고 403 예외가 발생합니다.AuthenticationProvider 구현체에서는 정상적으로 토큰을 저장하고 있습니다. AuthenticationProvider 구현체 소스@Component @RequiredArgsConstructor public class CustomAuthenticationProvider implements AuthenticationProvider { private final CustomUserDetailsService customUserDetailsService; private final PasswordEncoder passwordEncoder; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if(authentication == null){ throw new InternalAuthenticationServiceException("Authentication is null"); } LoginRequestDto loginRequestDto = (LoginRequestDto)authentication.getPrincipal(); String password = loginRequestDto.getLoginPassword(); UserAdapter userAdapter = (UserAdapter) customUserDetailsService.loadUserByLoinRequestDto(loginRequestDto); if (!passwordEncoder.matches(password, userAdapter.getCurrentUser().getLoginPwd())) { throw new BadCredentialsException("BadCredentialsException"); } CustomAuthenticationToken result = CustomAuthenticationToken.authenticated(userAdapter.getCurrentUser(), authentication.getCredentials(), userAdapter.getAuthorities()); result.setDetails(authentication.getDetails()); return result; } @Override public boolean supports(Class<?> authentication) { return CustomAuthenticationToken.class.isAssignableFrom(authentication); } } 이외 Custom 소스Spring Security 설정@EnableWebSecurity @RequiredArgsConstructor @Configuration public class DefaultSecurityConfig { private final CustomAuthenticationProvider customAuthenticationProvider; // private final CustomUserDetailsService customUserDetailsService; @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); } @Bean public CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter() throws Exception { CustomAuthenticationProcessingFilter filter = new CustomAuthenticationProcessingFilter(); // filter.setAuthenticationManager(authenticationManager(null)); filter.setAuthenticationManager(new ProviderManager(customAuthenticationProvider)); // filter.setAuthenticationSuccessHandler(customAuthenticationSuccessHandler()); // filter.setAuthenticationFailureHandler(customAuthenticationFailureHandler()); return filter; } // @formatter:off @Bean SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception { http .authorizeHttpRequests(authorizeRequests ->authorizeRequests .requestMatchers(CorsUtils::isPreFlightRequest).permitAll() .requestMatchers(new AntPathRequestMatcher("/")).permitAll() .requestMatchers(new AntPathRequestMatcher("/login/**")).permitAll() .requestMatchers("/api/login/**").permitAll() .requestMatchers("/api/registered-client/**").permitAll() .anyRequest().authenticated() ); http.addFilterBefore(customAuthenticationProcessingFilter(), UsernamePasswordAuthenticationFilter.class); http.exceptionHandling(httpSecurityExceptionHandlingConfigurer -> httpSecurityExceptionHandlingConfigurer .authenticationEntryPoint(new CustomLoginAuthenticationEntryPoint()) .accessDeniedHandler(customAccessDeniedHandler()) ); // http.userDetailsService(customUserDetailsService); // http.formLogin(); http.csrf().disable(); return http.build(); } // @formatter:on @Bean public AccessDeniedHandler customAccessDeniedHandler() { return new CustomAccessDeniedHandler(); } @Bean public AuthenticationSuccessHandler customAuthenticationSuccessHandler() { return new CustomAuthenticationSuccessHandler(); } @Bean public AuthenticationFailureHandler customAuthenticationFailureHandler() { return new CustomAuthenticationFailureHandler(); } } Ajax 로그인 처리 필터 소스public class CustomAuthenticationProcessingFilter extends AbstractAuthenticationProcessingFilter { private final ObjectMapper objectMapper = new ObjectMapper(); private static final AntPathRequestMatcher DEFAULT_ANT_PATH_REQUEST_MATCHER = new AntPathRequestMatcher("/api/login", HttpMethod.POST.name()); public CustomAuthenticationProcessingFilter() { super(DEFAULT_ANT_PATH_REQUEST_MATCHER); } public CustomAuthenticationProcessingFilter(AuthenticationManager authenticationManager) { super(DEFAULT_ANT_PATH_REQUEST_MATCHER, authenticationManager); } @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { if (!request.getMethod().equals("POST")) { throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); } LoginRequestDto loginRequestDto = objectMapper.readValue(request.getReader(), LoginRequestDto.class); if(StringUtils.isEmpty(loginRequestDto.getLoginId())||StringUtils.isEmpty(loginRequestDto.getLoginPassword())) { throw new IllegalStateException("Username or Password is empty"); } CustomAuthenticationToken authRequest = CustomAuthenticationToken.unauthenticated(loginRequestDto, loginRequestDto.getLoginPassword()); authRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); return getAuthenticationManager().authenticate(authRequest); } } CustomAuthenticationToken 소스public class CustomAuthenticationToken extends AbstractAuthenticationToken { private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; private final Object principal; private Object credentials; public CustomAuthenticationToken(Object principal, Object credentials) { super(null); this.principal = principal; this.credentials = credentials; setAuthenticated(false); } public CustomAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) { super(authorities); this.principal = principal; this.credentials = credentials; super.setAuthenticated(true); // must use super, as we override } public static CustomAuthenticationToken unauthenticated(Object principal, Object credentials) { return new CustomAuthenticationToken(principal, credentials); } public static CustomAuthenticationToken authenticated(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) { return new CustomAuthenticationToken(principal, credentials, authorities); } @Override public Object getCredentials() { return this.credentials; } @Override public Object getPrincipal() { return this.principal; } }
-
해결됨스프링 프레임워크는 내 손에 [스프1탄]
23.Spring MVC02 버전 만들기(Ajax, jQuery)
SPringMVC01 폴더를 복사 후, SpringMVC02 폴더로 변경해서 강의 순서대로 실행을 했는데, Mapping 경로를 찾지 못하는 오류가 발생했습니다. 그래서 해결 방법으로 [appServlet] - [servlet-context.xml] 파일 안에 19번째 줄 기존의 파일 내용 일부분을 수정했습니다. 이렇게 해도 괜찮을까요 ? 다른 방법이 있으면 알고 싶어요 ㅠ[servlet-context.xml] - 수정 전 <resources mapping="/resources/**" location="/resources/" /> [servlet-context.xml] - 수정 <resources mapping="/assets/**" location="/resources/assets/" /> <resources mapping="/ad_assets/**" location="/resources/ad_assets/" /> a
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
강사님의 강의노트
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.강사님의 강의노트를 사이트에서 계속 찾아봤는데 찾을수가 없네요. 강의노트(소스와 개념설명)를 다운받을 수 있는 방법을 부탁드립니다.
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
강의 시작
2023 기준으로 강의를 보려 할 때 스프링 3.0 기준으로는 어떻게 강의를 확인해야할까요 ?