JAVA Spring 환경설정
미해결
java spring 을 사용하려고합니다 근데 이때
- java
- javaspring
172만명의 커뮤니티!! 함께 토론해봐요.
미해결
java spring 을 사용하려고합니다 근데 이때
미해결
자바 ORM 표준 JPA 프로그래밍 - 기본편
Parent class @Id @GeneratedValue private Long id; private String name; @OneToMany(mappedBy = "parent",cascade = CascadeType.ALL) private List<Child> childList = new ArrayList<>(); public void addChild(Child... childArray) { for (Child child : childArray) { child.setParent(this); childList.add(child); } } Child class @Setter @Id @GeneratedValue private Long id; private String name; @ManyToOne @JoinColumn(name = "PARENT_ID") private Parent parent; Main 메서드 Parent parent = new Parent(); Child child = new Child(); Child child1 = new Child(); parent.addChild(child, child1); em.persist(parent); em.flush(); em.clear(); Parent findParent = em.find(Parent.class, parent.getId()); Child findChild = findParent.getChildList().get(0); em.remove(findChild); tx.commit(); Main메서드에서 findParent에서 자식 리스트를 가져와 첫번째 자식을 삭제해도 db에는 여전히 child, child1이 남아있는데 혹시 왜 그런지 알 수 있을까요?
미해결
제가 궁금한건 다른 페이지에 있을 때에도 스냅샷 함수를 가동시켜 비용이 계속해서 발생하는 것을 막기위해 온스냅샷 함수를 unsubscribe, 구독취소하는 코드인데요 어째서 제가 읽기에는 unsubscribe = ~ 온스냅샷함수 ~ . . . return () => unsubscribe함수 실행 useEffect cleanup기능으로 언마운트시 온스냅샷함수를 정지하려는데 다시 온스냅샷함수를 실행? 제가 어떻게 잘못 이해하는건지 모르겠어요 .. ㅠㅠ export default function Timeline() { const [tweets, setTweet] = useState<ITweet[]>([]); let unsubscribe: Unsubscribe | null = null; const fetchTweets = async () => { const tweetsQuery = query( collection(db, "tweets"), orderBy("createdAt", "desc"), limit(25) ); unsubscribe = await onSnapshot(tweetsQuery, (snapshot) => { const tweets = snapshot.docs.map((doc) => { const { tweet, createdAt, userId, username, photo } = doc.data(); return { tweet, createdAt, userId, username, photo, id: doc.id, }; }); setTweet(tweets); }); }; useEffect(() => { fetchTweets(); return () => { unsubscribe && unsubscribe(); }; }, []); }
미해결
실전! Querydsl
querydsl이 지원 중단되었다고 들었는데, 계속 사용할 메리트가 있을까요? 궁금해서 여쭤봅니다!
해결됨
김영한의 자바 입문 - 코드로 시작하는 자바 첫걸음
========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 강의를 보다가 문득 궁금한 부분이 생겨서 질문 드립니다. int의 경우 오버플로우가 발생하면 Long 형으로 형 변환을 하면 된다고 하셨는데 double을 사용하다가 오버플로우가 발생한다면 어떻게 처리를 하는지 궁금해져서 질문드립니다. 혹시 double형을 사용하면서 오버플로우가 발생하는 상황 자체가 잘 못 된것일까요?
미해결
비전공자를 위한 진짜 입문 올인원 개발 부트캠프
import { API_URL } from "./config/constants.js"; import avatarImg from "./assets/icons/avatar.png"; import React from "react"; import { StyleSheet, Text, View, Image, ScrollView, Dimensions, TouchableOpacity, Alert, } from "react-native"; import { GestureHandlerRootView } from "react-native-gesture-handler"; import Carousel from "react-native-reanimated-carousel"; import axios from "axios"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; import "dayjs/locale/ko"; dayjs.extend(relativeTime); dayjs.locale("ko"); export default function App() { const [products, setProducts] = React.useState([]); const [banners, setBanners] = React.useState([]); React.useEffect(() => { axios .get(`${API_URL}/products`) .then((result) => { const products = result.data.products; setProducts(products); }) .catch((error) => { console.log("error :", error); }); axios .get(`${API_URL}/banners`) .then((result) => { const banners = result.data.banners; setBanners(banners); }) .catch((error) => { console.log("error :", error); }); }, []); return ( <GestureHandlerRootView> <View style={styles.container}> <ScrollView> <Carousel data={banners} width={Dimensions.get("window").width} height={200} autoPlay={true} sliderWidth={Dimensions.get("window").width} itemWidth={Dimensions.get("window").width} itemHeight={200} renderItem={(obj) => { return ( <TouchableOpacity onPress={() => { Alert.alert("배너 클릭"); }} > <Image style={styles.bannerImage} source={{ uri: `${API_URL}/${obj.item.imageUrl}` }} resizeMode="contain" /> </TouchableOpacity> ); }} /> <Text style={styles.headline}>판매되는 상품들!</Text> <View style={styles.productList}> {products.map((product, index) => { return ( <View key={index} style={styles.productCard}> {product.soldout === 1 && <View style={styles.productBlur} />} <View> <Image style={styles.productImg} source={{ uri: `${API_URL}/${product.img_url}`, }} resizeMode={"contain"} /> </View> <View style={styles.productContents}> <Text style={styles.productName}>{product.name}</Text> <Text style={styles.productPrice}>{product.price}원</Text> <View style={styles.productFooter}> <View style={styles.productSeller}> <Image style={styles.productAvatar} source={avatarImg} /> <Text style={styles.productSellerName}> {product.seller} </Text> </View> <Text style={styles.productDate}> {dayjs(product.created_at).fromNow()} </Text> </View> </View> </View> ); })} </View> </ScrollView> </View> </GestureHandlerRootView> ); } const styles = StyleSheet.create({ headline: { fontSize: 24, fontWeight: "800", marginTop: 10, marginBottom: 10, }, container: { flex: 1, backgroundColor: "#fff", paddingTop: 32, margin: 10, }, productCard: { width: "100%", borderColor: "rgb(230,230,230)", borderWidth: 1, borderRadius: 16, backgroundColor: "white", marginBottom: 10, }, productBlur: { position: "absolute", top: 0, bottom: 0, right: 0, left: 0, backgroundColor: "#ffffffaa", zIndex: 999, }, productImg: { width: "100%", height: 210, }, productContents: { padding: 8, }, productSeller: { flexDirection: "row", }, productAvatar: { width: 24, height: 24, }, productFooter: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginTop: 12, }, productName: { fontSize: 14, }, productPrice: { fontSize: 16, fontWeight: "600", marginTop: 8, }, productSellerName: { fontSize: 14, }, productDate: { fontSize: 14, }, productList: { alignItems: "center", }, bannerImage: { width: "100%", height: 200, }, }); 어떤 오류메세지도 뜨지않고, 에뮬레이터에 화면이 출력되지않는 문제가 발생합니다. Carousel을 적용하기전에는 화면 잘 출력되었는데, Carousel을 적용하니 화면이 출력되지않네요.. Error: PanGestureHandler must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details. 이러한 오류가 발생해서 GestureHandlerRootView 태그로 최상단에 묶어주니 저 오류는 사라졌는데, 애뮬레이터의 화면이 출력되지 않는 문제가 발생합니다. 서버는 잘 연결되어있는걸 확인햇습니다.. 뭐가문제일까요
미해결
따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
Docker Engine v24.0.7 을 사용중입니다. 아래의 다른 분들처럼 DockerEngine 에서 설정으로 넣어도 적용 및 restart 해도 강의와 다른결과가 나옵니다.
미해결
실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 안녕하세요 강의에서 설명해주신 대로 따라하려고 했습니다. 단 , ddl-auto : create 대신 미리 SQL 문으로 테이블을 생성해놓고 ddl-auto: validate로 실행시 에러 가 납니다. 이는 실제로 배운 것을 사용할 수 없는 아주 치명적인 부분 이라고 생각하여 질문을 드립니다. [문제 설명] 강의에서 설명해주신대로 위와 같이 Enumerated 를 사용하여 status 를 정의 하였습니다. 말씀해주신대로 value = EnumType.STRING을 사용했습니다. UserStatus 는 당연히 enum 타입으로 했구요. @Column(name = "status", length = 32) @Enumerated(value = EnumType.STRING) private UserStatus status; 이때 status 가 있는 테이블은 아래와 같은 SQL문으로 생성하였습니다. VARCHAR(255)로 생성한 점을 자세히 봐주세요! dbms: MySQL CREATE TABLE user ( `id` BIGINT NOT NULL AUTO_INCREMENT, `status` VARCHAR(255) NOT NULL check (status in ('CREATED', 'WITHDRAW')), PRIMARY KEY (id) ); 또한 application-yml 에는 아래와 같이 ddl-auto 를 validate 로 하였습니다. jpa: hibernate: ddl-auto: validate properties: hibernate: format_sql: true show-sql: true 하지만 이를 실행하면 아래와 같은 status의 타입 오류 에러 가 나옵니다. Schema-validation: wrong column type encountered in column [status] in table [user]; found [varchar (Types#VARCHAR)], but expecting [enum ('created','withdraw') (Types#ENUM)] 이는 db의 status 의 타입이 enum 이길 기대했지만 실제로는 VARCHAR이기 때문에 에러가 발생한다는 것입니다. (ddl-auto의 validate에 의해 검증 수행) MySQL에서 타입에 enum을 적용하면 해결되지만 쓰는 것을 최대한 지양 해야 한다고 알고 있습니다. 따라서 mysql 의 status 컬럼의 타입을 enum 대신 column 타입을 varchar(255)로 두고 사용 하려고하는데 위와 같은 에러가 나서 실행이 되지 않습니다. ddl-auto : none 으로 설정하면 임시적으로 실행은 할 수 있지만 validate 로 검증을 항상 진행하려고 합니다. [질문 내용] 1. mysql의 타입을 varchar로 두고, ddl-auto: validate 를 사용하면서 에러 없이 실행할 수 있는 방법이 궁금합니다. 2. ddl-auto : create로 하게 되면 자동 생성되는 sql문에서는 status에 enum 대신 create table user ( id bigint not null, status varchar(255) check (status in ('CREATED', 'WITHDRAW')), primary key (id) ) 위처럼 varchar로 column 속성을 주면서 validate 할때만 에러가 나는것이 이상한 것 같은데 왜 그럴까요? 3. 이를 현업에서는 어떻게 해결하고 계신지 궁금합니다.
미해결
김영한의 실전 자바 - 기본편
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 다른 분께서 올려주신 질문 글을 읽고 저 또한 같은 의문이 생겼지만, 그에 대한 답변이 저에게는 잘 와 닿지 않아서 제가 이해한 바를 적어봅니다. 상속 관계에 있는 객체의 메서드를 사용할 때는, 우선 메서드를 사용하는 변수의 참조값을 따라 인스턴스를 찾고, 인스턴스 내의 변수 타입과 동일한 클래스 타입부터 시작하여 메서드를 찾는다고 하셨습니다. 그리고 이렇게 메서드를 찾을 때는 자식 클래스에서 부모 클래스 방향으로 올라가는 것만 가능하고, 부모 클래스에서는 자식 클래스에 대한 정보가 없으므로 반대는 불가능하다고 말씀하셨습니다. 그런데 부모 변수가 자식 인스턴스를 참조하는 다형적 참조의 경우, 메서드를 호출하는 변수의 타입은 부모 클래스이므로 메서드를 부모 클래스에서 찾을 것이고, 부모 클래스는 자식 클래스에 대한 정보가 없는데 어떻게 자식 클래스에 해당 메서드가 오버라이딩이 되었는지 판단하는지 잘 이해가 되지 않았습니다. 제 식대로 내린 결론은 다음과 같습니다. 다형적 참조에서는 변수의 타입은 Parent지만, 이 변수가 참조하는 것은 자식 인스턴스인 Child입니다. 호출된 메서드를 찾을 때는 변수의 타입과 같은 Parent에서 탐색하는 것은 맞지만, 오버라이딩 여부는 Child 인스턴스 내에서 별개로 확인하는 것이고 Parent 인스턴스와는 무관합니다.제가 이해한 방식이 맞나요?
미해결
따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
Learn React를 바꿔도 바로바로 적용이 안됩니다. docker-compose.yml은 아래와 같이 작성했습니다 version: "3" services: react: build: context: . dockerfile: Dockerfile.dev ports: - "3000:3000" volumes: - /usr/src/app/node_modules - ./:/usr/src/app stdin_open: true
해결됨
손에 익는 Next.js - 공식 문서 훑어보기
안녕하세요 선생님! 좋은 강의 정말 감사하게 듣고 있습니다. 선생님의 강의를 듣다보니, Next.js 13의 Data Fetching 방법이 React Query과 유사함을 느꼈습니다. (주니어라 부족함이 있어 실제론 유사하지 않을 수도 있지만..!) Next 13의 데이터 패칭 방법이 react 에서 React Query를 사용하여 서버 API의 데이터를 일정 시간동안 fresh 상태로 갖고 있는것 stale한지 chach로 체크하는 것 모두 흡사 하다고 느꼈습니다. React Query의 가장 큰 강점은 클라이언트-서버간의 데이터 동기화가 가장 큰 장점이라고 생각하는데 만약 Next 13의 데이터 패칭 방법을 사용한다면 번거로운 React Query의 보일러코드들을 사용하지 않아도 React Query의 장점을 그대로 살려 쉽게 사용할 수 있을 것 같아보입니다! 따라서, Next 13에선 React Query가 무한스크롤 외에 사용할 일이 거의 없을 것만 같아보이는데...! 어떻게 생각하실지 의견이 궁금합니다...! next 13과 react query 조합은 앞으로 거의 사용하지 않게 되는 걸까요? 선생님의 고견을 나눠주시면 감사하겠습니다~! 바쁘실텐데 번거롭게 해드려서 죄송합니다! 감사합니다!
미해결
따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
Dockerfile.dev에서는 CMD 사용하고 Dockerfile에서는 RUN을 사용하는데 차이점이 뭘까요? Dockerfile.dev에서도 RUN 사용하면 안되나요?
미해결
자바 ORM 표준 JPA 프로그래밍 - 기본편
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 양방향 매핑을 할 때와 단방향 매핑을 할 때의 성능 차이가 있나요? 그러니까, 단방향 매핑을 한 후, 각 엔티티의 레포지토리를 통해 명시적으로 조회하는 것과, 양방향 매핑을 한 후, get을 사용하여 조회하는 상황의 성능 차이에 대해 궁금합니다. 지연로딩을 사용하는 경우, 결국 나가는 쿼리 수는 같지 않나요?
미해결
따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
15.97 src/components/header/Header.tsx(1,8): error TS6133: 'React' is declared but its value is never read. 15.97 src/components/header/Header.tsx(6,19): error TS6133: 'setIsLogin' is declare d but its value is never read. 15.98 src/components/header/Header.tsx(9,9): error TS6133: 'border' is declared but its value is never read. 15.99 src/components/htmlEditor/HtmlEditor.tsx(1,8): error TS6133: 'React' is decla red but its value is never read. 15.99 src/components/htmlEditor/HtmlEditor.tsx(2,20): error TS7016: Could not find a declaration file for module '@toast-ui/editor'. '/app/node_modules/@toast-ui/edit or/dist/esm/index.js' implicitly has an 'any' type. 15.99 There are types at '/app/node_modules/@toast-ui/editor/types/index.d.ts', b ut this result could not be resolved when respecting package.json "exports". The '@ toast-ui/editor' library may need to update its package.json or typings. 15.99 src/main.tsx(1,1): error TS6133: 'React' is declared but its value is never r ead. 15.99 src/pages/myPage/MyPost.tsx(1,1): error TS6133: 'React' is declared but its v alue is never read. 15.99 src/pages/post/ReadPage.tsx(1,8): error TS6133: 'React' is declared but its v alue is never read. 15.99 src/pages/post/ReadPage.tsx(4,1): error TS6133: 'search' is declared but its value is never read. 15.99 src/pages/post/ReadPage.tsx(8,19): error TS6133: 'setIsLogin' is declared but its value is never read. ------ failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 2 이런 오류는 어떡하나요?
미해결
김영한의 실전 자바 - 기본편
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (아니오) [질문 내용] System.out.print(i+1+"번째 주문 정보 입력"); System.out.print("상품명 : "); String productName = scanner.nextLine(); System.out.print("가격 : "); int price = scanner.nextInt(); System.out.print("수량 : "); int quantity = scanner.nextInt(); scanner.nextLine(); //입력 버퍼를 비우기 위한 코드 price 입력 받을 때와 quantity 입력 받을 때 둘다 int형으로 입력을 받는데 quantity 수량 받을 때는 nextLine을 해주는데, 왜 price를 받을 때는 nextLine을 안해줘도 되는것일까요?
미해결
따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
마지막 배포시에 Run echo "***" | docker login -u "***" --password-stdin 2 echo "***" | docker login -u "***" --password-stdin 3 shell: /usr/bin/bash -e {0} 4 Error response from daemon: Get " https://registry-1.docker.io/v2/ ": unauthorized: incorrect username or password 5 Error: Process completed with exit code 1. 에러가 지속적으로 발생합니다. 도커 로그인에 사용되는 유저네임과 비밀번호를 그대로 입력하였음에도 계속해서 발생하는 문제입니다.
미해결
따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
he command "docker run -e CI=true tedkov2024/docker-react-nginx-app npm run test -- --coverage" exited with 127. 85.61s$ docker build -t tedkov2024/docker-react-nginx-app -f Dockerfile . 0.60s$ docker run -e CI=true tedkov2024/docker-react-nginx-app npm run test -- --coverage /docker-entrypoint.sh: 47: exec: npm: not found The command "docker run -e CI=true tedkov2024/docker-react-nginx-app npm run test -- --coverage" exited with 127. Done. Your build exited with 1. 무엇이 문제인지 모르겠습니다.
미해결
따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
이 설명하는 파일 어디서 볼수 있나요?
해결됨
김영한의 실전 자바 - 기본편
예를 들어 ElectricCar extends Car, Car extends Vehicle의 상속 관계를 가질 때 new ElectricCar()를 호출하면 부모 인스턴스인 Car도 같이 생성하는데 이 경우 Car는 Vehicle 의 상속을 받으니까 Vehicle 인스턴스도 함께 생성되나요?
미해결
스프링 시큐리티 OAuth2
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. OicdUserService의 아래 메서드에서 true를 반환해버리는데요. 우선 해당 함수의 if(authroization_code 이냐?) 분기를 타고, accessibleScopes가 empty 가 아닙니다. 아마 키클록에서 default 스코프가 있기 때문인거 같은데요. shouldRetrieveUserInfo 해당 영상에서는 키클록의 default 스코프가 빠진걸까요? 아니면 grant type 문제일까요? 참고로 grant type 은 별다른 옵션 없이도, registration repository에서 꺼내오는 순간 registration에는 authroization_code 입니다.