inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

섹션 8 - 옵션처리 (TestBean)

미해결

스프링 핵심 원리 - 기본편

========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? ( 예 /아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? ( 예 /아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/ 아니오 ) [질문 내용] 안녕하세요, " 섹션8 - 옵션처리 " 강의 관련하여 질문합니다. 먼저 AutowiredTest 코드 공유합니다 package hello.core.autowired; import hello.core.member.Member; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.lang.Nullable; import java.util.Optional; public class AutowiredTest { @Test void AutowiredOption() { ApplicationContext ac = new AnnotationConfigApplicationContext(TestBean.class); } static class TestBean { @Autowired(required = false) public void setNoBean(Member noBean1) { System.out.println("noBean1 = " + noBean1); } @Autowired public void setNoBean2(@Nullable Member noBean2) { System.out.println("noBean2 = " + noBean2); } @Autowired public void setNoBean3(Optional<Member> noBean3) { System.out.println("noBean3 + " + noBean3); } } } ApplicationContext ac = new AnnotationConfigApplicationContext(TestBean.class); 를 통해 TestBean을 등록하고 위와같이 Autowired관련 테스트를 위한 코드를 강의 내용과 같이 작성하였습니다. 하지만 @Autowired 어노테이션에 붉은줄이 생기며 "Autowired members must be defined in valid Spring bean"라는 에러가 발생합니다. 동일한 파일에서 아래와 같은 TestCofig 클래스 코드를 추가해주면 에러가 사라집니다. 제가 작성한 코드에 어떠한 문제가 있는지 아직 파악하지 못하여 의문을 풀지 못하였습니다. @Configuration static class TestConfig { @Bean public TestBean testBean() { return new TestBean(); } }

  • spring
  • 객체지향
건강한 말미잘 댓글 2 좋아요 1 조회수 212

Calendar 앱 프로젝트 StreamBuilder 질문

미해결

[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

마무리 수업에 리스트 개수 화면에 나타낼 때, StreamBuilder를 하나 더 사용하는데 (ListView에도 사용 중) 하나로 합치는게 더 좋을까요 아니면 따로 작성하는게 좋은가요? 중복의 관점에서 생각해 본 것입니다.

  • flutter
  • 클론코딩
pabeba 댓글 2 좋아요 0 조회수 80

travis ci가 이제 유료화가 된 것 같습니다;;;

미해결

따라하며 배우는 도커와 CI환경 [2023.11 업데이트]

이거 무료로 할 수 있는 방법이 있을까요? 인강 진행이 안되네요.

  • aws
  • docker
  • github
  • ci/cd
  • travis-ci
  • 데이터-엔지니어링
윤석배 댓글 2 좋아요 0 조회수 238

안녕하세요 선생님,

미해결

파이썬/장고로 웹채팅 서비스 만들기 (Feat. Channels) - 기본편

#consumers.py from asgiref.sync import async_to_sync from channels.generic.websocket import JsonWebsocketConsumer from chat.models import Room # 모든 유저가 고정된 채널 레이어 그룹을 가질것. class ChatConsumer(JsonWebsocketConsumer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) SQUARE_GROUP_NAME = "square" self.group_name = [SQUARE_GROUP_NAME] self.room = None def connect(self): user = self.scope['user'] if not user.is_authenticated: self.close() else: room_name = self.scope['url_route']['kwargs']['room_pk'] try: self.room = Room.objects.get(pk=room_name) except Room.DoesNotExist: #지정 룸 pk에 룸 인스턴스가 없을 경우 웹소켓 연결요청 수락. pass else: self.group_name = self.SQUARE_GROUP_NAME is_new_join = self.room.user_join(self.channel_name, user) if is_new_join: async_to_sync(self.channel_layer.group_send)( self.group_name, { "type": "chat.user.join", "username": user.username, } ) async_to_sync(self.channel_layer.group_add)( self.group_name, self.channel_name ) self.accept() def disconnect(self, code): if self.group_name: async_to_sync(self.channel_layer.group_discard)( self.group_name, self.channel_name ) user = self.scope['user'] if self.room is not None: is_last_leave = self.room.user_leave(self.channel_name, user) if is_last_leave: async_to_sync(self.channel_layer.group_send)( self.group_name, { "type": "chat.user.leave", "username": user.username, } ) def chat_user_join(self, message_dict): self.send_json({ "type": "chat.user.join", "username": message_dict["username"], }) def chat_user_leave(self, message_dict): self.send_json({ "type": "chat.user.leave", "username": message_dict["username"], }) def chat_message(self, message_dict): self.send_json({ "type": "chat.message", "message": message_dict["message"], "sender": message_dict["sender"], }) def receive_json(self, content, **kwargs): user = self.scope["user"] _type = content["type"] if _type == "chat.message": message = content["message"] sender = user.username async_to_sync(self.channel_layer.group_send)( self.SQUARE_GROUP_NAME, { "type": "chat.message", "message": message, "sender": sender, } ) else: print(f"Invalid message type : ${_type}") room_name = self.scope['url_route']['kwargs']['room_pk'] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'room_pk' 이런 에러가 나서, urls.py, views.py, index.html도 맞춰줘 봤지만, 잘 해결이 되질 않습니다. 어떤식으로 이 에러를 처리해야할까요. 오늘도 좋은 하루 되시길 바랍니다. 감사합니다.

  • python
  • django
  • django-channels
sunnnwo 댓글 1 좋아요 0 조회수 124

안녕하세요

해결됨

스프링 시큐리티 OAuth2

여기에 글을 남겨서 죄송합니다 ㅠㅠ 수강전 문의에는 이어서 답변하기 기능이 없어서 여기로 하는 점 양해 부탁드립니다. 25년 2월 16일에 스프링 배치 할인이 시작 되게 해주신점 감사드립니다. 하지만 조금더 일찍 제가 구매할 수 있을까요? 다음주에 면접이 잡혀서 ㅠㅠ 한번 공부하고 가면 훨씬 도움이 될거 같습니다.

쭈도리 댓글 1 좋아요 0 조회수 137

상세페이지로 이동하는 url을 받아서 이동할때, url유형이 달라요

미해결

[신규 개정판] 이것이 진짜 크롤링이다 - 실전편 (인공지능 수익화)

상세페이지 href속성을 찾아 기존페이지 url?상세페이지 url을 적용하여 실습을 성공해 오다가 난관에 부딪혔습니다. html속성값을 보니 아래와 같이 되어 있고 url에 붙이거나 해도 페이지가 로드 되지 않아 어려움을 겪고 있습니다. <a href="Javascript:view_content('869');">처리 일정 문의 드립니다.</a> 위와같은 href가 나타날때는 어떻게 상세페이지로 이동해야 하는지 궁금하고 이럴때 혹시 우회할 수 있는 대안이 있다면 알고 싶어요

  • python
  • 웹-크롤링
민소리 댓글 1 좋아요 0 조회수 126

for each반복문에 대해서요

미해결

홍정모의 따라하며 배우는 C++

for ( int number : fibonacci){ cout << number << " " ; } cout << endl ; 여기서 number는 그냔 for문의 i 같은거고 foreach문 {} 안에서만 존재하는 변수죠? 그리구 배열에만 사용할 수 있는 반복문인게 맞나요?

  • c++
hansh4530 댓글 2 좋아요 1 조회수 121

PossessedBy() 함수는 싱글플레이에서는 호출되지 않나요?

미해결

이득우의 언리얼 프로그래밍 Part4 - 게임플레이 어빌리티 시스템

PossessedBy 함수가 서버에서만 호출된다면, 싱글플레이용 게임에서는 어느 위치에서 Character 의 ASC 에 PlayerState 의 ASC 를 대입하는게 적절할지 궁금합니다.

  • unreal-engine
  • ue-blueprint
  • unreal-engine5
  • 언리얼-c++
  • gas
댓글 2 좋아요 0 조회수 185

Private 도메인 연결 error

해결됨

NAVER Cloud Boot Camp - 네이버 클라우드 부트 캠프

설정을 따라하고 private도메인을 가지고 test를 했는데 이렇게 나옵니다.. 혹시 강의내용만 따라했는데.. vpc,subnet말고 혹시 다른 걸 또 설정해야 하나요?

  • 네이버-클라우드
나그네 댓글 2 좋아요 0 조회수 143

수강하는데 얼마나 걸릴까요

해결됨

이거 하나로 종결-스프링 기반 풀스택 웹 개발 무료 강의

안녕하세요. 수강해보려고 하는데, 최대한 빠르게 끝내보고 싶습니다. c++ 문법 정도만 알고 있는 수준인데, 공부 기간은 얼마 정도로 예상하시나요?

  • HTML/CSS
  • javascript
  • jsp
  • spring
  • spring-boot
  • spring-security
yeonm217 댓글 1 좋아요 0 조회수 417

UserEffect 빈 배열 사용 질문입니다

미해결

프로젝트로 배우는 React.js

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. UserEffect 빈 배열 사용하면 처음 한번만 실행된다고 하는데 그러면 조건문으로 posts 체크해서 사용해도 되나요? 왠지 유저이펙트보다 이프문이 더 가벼울것 같아서 질문드립니다

  • react
  • redux
  • es6
좀 해 댓글 2 좋아요 0 조회수 176

NonFlip과 삼각근 수업 내용 질문드립니다!

미해결

게임 캐릭터를 위한 3ds Max 리깅의 기초

안녕하세요 교수님, 내용중에 궁금한 점이 있어 질문 남겨 봅니다. NonFlip과 삼각근 수업 18:14 ~ 18:21 초에 " 지금은 포인트 헬퍼로 설명하지만 리깅 할 때는 본을 만들어 주겠죠 " 라고 하셨는데, 스키닝본 (=익스포트본) 을 따로 있는 리깅을 할 꺼라면, 지금 하신 것 처럼 헬퍼들로 구성해도 괜찮은 것 아닌가요? 리깅할때면 본으로 했을 거라는 것에 어떤 이유가 있을지 좀 더 궁금합니다.

  • 3ds-max
  • 리깅
  • 캐릭터-디자인
박천성 댓글 1 좋아요 1 조회수 135

MemberRepositoryTest junit5로 고친후 오류발생 + junit4를 사용해야만 할까요?

미해결

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

junt4로 gradle에서 설정하려고 하면 오류가 발생해서 juit5로 하는 중입니다. MemberRepositoryTest를 junit5버전으로 고쳐서 아래의 코드로 실행했는데 오류가 나고 있습니다 import jpabook.jpashop.Member; import jpabook.jpashop.MemberRepository; //import jpabook.jpashop.domain.Member; //import jpabook.jpashop.repository.MemberRepository; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; @ExtendWith(SpringExtension.class) // JUnit 5 방식 @SpringBootTest public class MemberRepositoryTest { @Autowired MemberRepository memberRepository; @Test @Transactional @Rollback(false) public void testMember() { Member member = new Member(); member.setUsername("memberA"); Long savedId = memberRepository.save (member); Member findMember = memberRepository.find(savedId); Assertions.assertThat(findMember.getId()).isEqualTo(member.getId()); Assertions.assertThat(findMember.getUsername()).isEqualTo(member.getUsername()); Assertions.assertThat(findMember).isEqualTo(member); // JPA 엔티티 동일성 보장 } } 밑에는 오류입니다. Unable to find a @SpringBootConfiguration by searching packages upwards from the test. You can use @ContextConfiguration, @SpringBootTest(classes=...) or other Spring Test supported mechanisms to explicitly declare the configuration classes to load. Classes annotated with @TestConfiguration are not considered. java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration by searching packages upwards from the test. You can use @ContextConfiguration, @SpringBootTest(classes=...) or other Spring Test supported mechanisms to explicitly declare the configuration classes to load. Classes annotated with @TestConfiguration are not considered. at org.springframework.util.Assert.state(Assert.java:79) 1. @SpringBootTest(classes=...) 로 명시적으로 설정 클래스 지정 2. @SpringBootApplication 이 있는 클래스의 위치 확인 3. @ContextConfiguration 을 사용해서 명시적으로 설정 클래스 지정 이세가지를 시도해도 안되고 있습니다. 아니면 juni4룰 사용해야만 할까요? build.gradle에 JUnit4 추가 testImplementation("org.junit.vintage:junit-vintage-engine") { exclude group: "org.hamcrest", module: "hamcrest-core" } 를 하면 Build file 'C:\Users\Peter\Desktop\study\jpashop\build.gradle' line: 45 A problem occurred evaluating root project 'jpashop'. > Could not find method testImplementation() for arguments [org.junit.vintage:junit-vintage-engine, build_55eer8btj8rd1l6xp0yqapa0y$_run_closure6@6e20627f] on root project 'jpashop' of type org.gradle.api.Project. 라고 나옵니다.

  • java
  • spring
  • 웹앱
  • spring-boot
  • jpa
댓글 3 좋아요 0 조회수 480

SbbApplicationTests 런오류 tetJpa부분?

미해결

백엔드 개발을 위한 필수 강의 - 스프링 부트3

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2025-02-13T00:15:43.156+09:00 ERROR 7780 --- [ main] o.s.boot.SpringApplication : Application run failed Error creating bean with name 'entityManagerFactory' 이런 오류가 뜹니다 쿼리가 안 만들어져요 이오류 때문에 ㅜ

  • java
  • aws
  • spring-boot
손진주 댓글 1 좋아요 0 조회수 104

영문 영수증 발급 가능 여부

미해결

안녕하세요 강의 수강후 영문 영수증 발급 가능한지 문의 드립니다 영어 컨텐츠도 있어서 발급 가능할 것 같은데 궁금하네요

  • 영수증
  • 영어
Byeonggil Park 댓글 1 좋아요 0 조회수 79

3-G 숨바꼭질 2 코드 질문있습니다.

해결됨

10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트

안녕하십니까 큰돌님 강의에서 수빈이랑 동생이랑 위치가 같을 때의 반례를 설명해주시면서 if 문이 없으면 틀렸다고 할 거라고 했는데 http://boj.kr/590703c7959a401f986529dd681c4972 복습하면서 모르고 없이 그냥 제출했는데 통과를 해서 질문드립니다.

  • c++
  • 코딩-테스트
대기업목표 댓글 2 좋아요 0 조회수 92

AI

해결됨

[UI3 업데이트] 피그마 배리어블을 활용한 디자인 시스템 구축하기

안녕하세요, 볼드님 강의 업데이트 해주셔서 정말 감사합니다. 기존 피그마 버전을 사용하고 있는데, 볼드님 강의를 듣는 도 중 AI기능이 쓰는 방식을 배울 수 있었는데요. Ai 기능을 쓰고 싶으면 업데이트를 해야할 것 같아서요 .. 찾아보니 맨 하단에 토글을 켜야 쓸 수 있는 것 같습니다. ㅜㅜ 아마 못 쓰는 것이겠죠 ㅜㅜ 방법이 있을지 궁금합니다.

  • 웹-디자인
  • figma
  • figma-tokens
  • 디자인-시스템
  • 아토믹-디자인
  • figma-variable
  • 프로덕트디자인
이민지 댓글 2 좋아요 0 조회수 157

강의 자료는 따로 없을까요??

미해결

비전공자도 따라하는 워드프레스 홈페이지 제작

강의 자료는 따로 없을까요??

  • wordpress
  • 도메인
  • no-code
MAS9 댓글 1 좋아요 0 조회수 83

인기 태그

인프런 TOP Writers

주간 인기글