안녕하세요. 클린코드 3탄을 수강하고 너무 만족스러워서 이번 추석에 2탄을 추가로 수강했습니다. ㅎㅎ 2탄에서 뷰모델이 생성될 때 직접 데이터를 넣으시더군요.(객체가 아닌 일반 변수) 평소에 뷰모델이 생성될 때 객체가 아닌 변수도 같이 바로 넣으려고 했으나 클래스(객체)가 아니기 때문에 매번 뷰를 생성하고 initstate 에서 lazy 하게 뷰모델에 데이터를 업데이트 했었습니다. 여기서 의문이 생겨서 질문 드립니다. 객체가 아닌 일반 변수에 대해서도 의존성 주입을 하는 것이 옳은 것인가요? 만약 일반 변수에 대해서도 의존성 주입을 해야한다면(해도 된다면) getit 설정에서 어떻게 접근 하면 좋을 까요? 늦은 시간에 죄송합니다. 답변 주시면 감사하겠습니다.!!
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 안녕하세요. 현재 '실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발 강의'에서 'JPA와 DB 설정, 동작확인' 강의를 듣고 있습니다. H2 데이터베이스에 연결하고, 테스트 코드를 실행해서 통과했다고 나옵니다. 그런데 강의 영상처럼 create table, drop table 등의 메시지가 터미널에 나오기는 하는데 제대로 된 건지 잘 모르겠습니다. 그리고 가장 큰 문제는 H2 데이터베이스에 Member 테이블이 생성되지 않았습니다. 아래 코드와 스크린샷을 첨부합니다. 제가 한 부분 중 잘못된 부분이 있는 건지 궁금합니다. 그리고 어떻게 하면 해결할 수 있는지 궁금합니다. Member package jpabook.jpashop; import lombok.Getter; import lombok.Setter; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity @Getter @Setter public class Member { @Id @GeneratedValue private Long id; private String username; } MemberRepository package jpabook.jpashop; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Repository public class MemberRepository { @PersistenceContext private EntityManager em; public Long save(Member member) { em.persist(member); return member.getId(); } public Member find(Long id) { return em.find(Member.class, id); } } application.yml spring: datasource: url: jdbc:h2:tcp://localhost/~/jpashop username: sa password: driver-class-name: org.h2.Driver jpa: hibernate: ddl-auto: create properties: hibernate: # show_sql: true format_sql: true logging.level: org.hibernate.SQL: debug org.hibernate.type: trace #스프링 부트 2.x, hibernate5 org.hibernate.orm.jdbc.bind: trace #스프링 부트 3.x, hibernate6 MemberRepositoryTest package jpabook.jpashop; import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import static org.junit.jupiter.api.Assertions.*; @RunWith(SpringRunner.class) @SpringBootTest public class MemberRepositoryTest { @Autowired MemberRepository memberRepository; @Test @Transactional public void testMember() throws Exception { //given Member member = new Member(); member.setUsername("memberA"); //when Long saveId = memberRepository.save(member); Member findMember = memberRepository.find(saveId); //then Assertions.assertThat(findMember.getId()).isEqualTo(member.getId()); Assertions.assertThat(findMember.getUsername()).isEqualTo(member.getUsername()); } } 테스트 결과의 일부분 스크린샷 이 상태로 H2에 접속했습니다. 테스트 후 H2 데이터베이스의 스크린샷 위의 스크린샷처럼 테스트를 실행하면 통과로 나오기는 합니다. 그렇지만 강의 영상처럼 create table, drop table이라고 되어있는 부분이 있지만 제대로 된 건지 모르겠습니다. 그리고 테스트 후 H2 데이터베이스를 보면 Member가 생성되지 않았습니다.(가장 큰 문제) 제 코드나 제가 실행한 부분 중에서 잘못된 부분이 있는지 궁금합니다. 그리고 해결 방법도 궁금합니다. 감사합니다.
안녕하세요. 수강생입니다. 강의를 듣다보니 레이블과 레이블정책의 차이를 잘 모르겠어서 질문드립니다. 레이블이 꼬리표, 레이블정책이 꼬리표를 붙일 수 있는 권한이라고 할때 그럼 레이블을 만들고 레이블정책을 만들고 문서와 꼬리표를 연결해주는 것은 어디서 하게 되는 건가요? 레이블정책을 만들면 해당 레이블의 문서를 작성하게 되면 레이블정책 시에 설정한 기본 레이블이 부여되는 것인가요?
안녕하세요~! 프론트에 관심이 생겨서 재미있게 강의를 듣고 있는 백엔드 개발자 입니다. 강의를 듣다보니 js는 component를 작성할 때 클래스를 만드는 것보다는 함수를 만들어서 해결하는 것 같은데요. 컴포넌트 클래스를 생성하고 spring framework 처럼 IoC를 사용하여 각 컴포넌트간에 DI를 사용할 수는 없는 건가요? 감사합니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 여기에 질문 내용을 남겨주세요. 강의와 같은 방법으로 설정하여도 intelliJ와는 달리 vscode에서 test/resources/ application.properties 안의 spring.profiles.active를 못 인식하는 문제가 있습니다. 이거때문에 너무 고통 받아 해결방법을 공유합니다. main/resources 안에 application-dev.properties 와 application-test.properties 를 생성합니다. main/resources/ application.properties 의 내용 중 spring.profiles.active 줄을 제외한 나머지를 -dev에 복붙합니다. test/resources/ application.properties 의 내용 역시 위와 같은 방법으로 spring.profiles.active 줄을 제외한 나머지를 -test에 복붙합니다. main/resources/ application.properties 안 모든 내용을 삭제하고 spring.profiles.active=dev 만 작성합니다. junit 테스트 중인 클래스 위에 @ActiveProfiles("test")를 추가합니다. 추가로 vscode에서 test 설정은 앞으로 -test에서 하시면 됩니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] RateDIscountPolicy로만 불러오는게 아니라 왜 private final DiscountPolicy discountPolicy = new FixDiscountPolicy(); 처럼 인터페이스로부터 불러 오나요? 인터페이스는 구현체를 만들때에만 쓰이는게 아닌가요?
프로그래밍 시작하기 : 도전! 45가지 파이썬 기초 문법 실습 (Inflearn Original)
안녕하세요~ 2가지 질문 드립니다. def add_member(d) 함수를 만들 때 name_check를 넣으셨는데, 없어도 함수를 돌리는 데에는 문제가 없어 보입니다. 중간에 체크를 넣으신 이유가 있을까요? json 파일은 'a+' 모드가 없고 'r'과 'w'만 가능한 것으로 알고 있습니다. 초반에 'r'로 읽어오고 종료하기 직전에 'w'로 쓰고 종료해도 괜찮을까요? with open ('../source/45-1.json', 'r') as file: phonebook = json.load(file) < 1~3 중간 내용 동일 > elif menu == '4': with open ('../source/45-2.json', 'w') as out: json.dump(d, out) print('Exit') break
안녕하세요:) 본 문제의 재귀 함수(go 함수) 안에서, b가 홀수인 경우 ret = ret * a % c; 가 되어야 하는 부분에 대해 한번 더 %c 연산을 하지 않아도 되는지 문의드립니다. 예를 들어 (a^5)%c의 경우, [{(a^4)%c}{a%c}]%c 와 같다고 이해했습니다. 이때 b=5 이므로 if(b%2) 에 걸리는데, ret가 (a^4)%c 인 상황에서 (a%c)%c 만큼 추가로 곱해줘야 성립이 되는게 아닌지 궁금합니다! ( 만일 (a^4)%c 에 (a%c) 만 곱한다면 그 값이 c 보다 커져서 나머지 연산을 한번 더 해야할 경우도 있지 않나요? ) 감사합니다 :)
안녕하세요:) 일곱난쟁이 문제에서 "결과값을 오름차순으로 출력" 해야하는 부분과 관련하여 문의드립니다. next_permutation을 활용하여 경우의 수를 뽑는 경우에, 앞에서 부터 7개 순열을 잘라서 보면 어떤 것은 오름차순으로 되어있지 않은데 혹시 만일 그러한 순열이 답이 되는 경우 sort로 정렬을 다시 안해줘도 되나요? 예를 들어, 본 문제 테스트케이스의 경우[ 7 8 10 13 19 20 23] 이라는 값이 딱 sum이 100인 경우여서 오름차순 그대로 값이 출력이 되지만.. 만약 [7 8 10 13 15 25 19] 가 답이었다고 가정한다면 .. 오름차순이 안되는게 아닌지 해서요! 감사합니다:)
Finding IELTS (International English Language Testing System) schools nearby can be crucial if you're studying for this well-known English language competence test. A high IELTS score might lead to endless international opportunities. If you are looking for ' IELTS classes near me ' - then AbroAdvice.com has everything you need. However, if you are looking for signs on how to locate the best IELTS courses, then here they are: IELTS official website A trustworthy place to start is the official IELTS website (ielts.org). It provides thorough details regarding the test, test locations and approved test prep companies. Find IELTS test centers that are officially registered. Continue reading to know more about study abroad counseling . Online learning platforms IELTS exams are conducted 48 times a year meaning students have more than one opportunity to crack it. To make it convenient consider enrolling in IELTS prep courses online when you are flexible. These portals provide a selection of courses and training resources. Social Media and Forums Join neighborhood Facebook groups, Reddit forums, or discussion boards. There you can get suggestions and guidance on IELTS courses nearby. Language Schools and Institutes Nearby language schools or institutes frequently offer IELTS preparation classes. Look for reputable universities with knowledgeable faculty. Colleges and Universities Certain universities and colleges provide IELTS preparation classes to assist prospective students in meeting language requirements. Check with local institutions. Use well-known search engines like Google to look up "IELTS classes near me" or "IELTS preparation courses in [your location]." There are several selections available, along with reviews and ratings. Educational Directories Language schools and tutoring facilities are frequently listed in online directories like Yelp, Yellow Pages, or educational websites. Search for the nearest selections while reading reviews. Groups on Meetup Find language exchange and English-learning groups. Some of these organizations also plan IELTS prep courses. Visit your neighborhood library or community center to see if they provide language or exam preparation programs. They might offer no-cost or inexpensive classes. Tutoring Services Look for private IELTS tutors in your neighborhood who can offer customized, one-on-one training. You can discover tutors using websites like Wyzant and Preply. Inquire about Referrals Ask friends, relatives, coworkers, or classmates who may have participated in IELTS preparation programs for recommendations. Personal recommendations can be beneficial. Local publications Some IELTS education providers may run advertisements in regional publications. Look for listings in the classifieds. Find people in your neighborhood who speak English well. Those who are interested in language exchange as language exchange partners can give you promising leads. They can offer advice or suggest classes. Visit Language Schools Directly Take the time to go directly to language schools or institutions to meet the staff. Check out the surroundings, and evaluate the level of instruction. Visiting and seeing the authenticity of yourself can help you make better decisions. Selecting the best local IELTS class might improve your chances of getting the target IELTS score. Take no risks with it and ensure you are picking a good site. Follow the tips mentioned above to ensure you pick the best centre.
#include <iostream> #include <cstdio> using namespace std; class Parent { public: Parent() { this->parent_pri = 2; } virtual void pri_print() { printf("%d", parent_pri); } private: int parent_pri; }; class Public_Child : public Parent{}; int main() { Public_Child public_child; public_child.pri_print(); } 이거를 실행하면 비쥬얼 스튜디오에서 2가 출력이 되는데, 클래스 밖의 main 함수에서 public_child.pri_print()에 접근할 수 있는 이유가 public 이기 때문이고, 그 public안의 pri_print함수는 클래스 Parent의 멤버 함수이기 때문에 private로 지정되어 있는 parent_pri에 접근할 수 있기 때문인가요?