안녕하세요. 정확하게 어떤 부분이라기 보다는 제가 부모의 기본 생성자 호출 관련하여 정확하게 이해를 하지 못해 질문드립니다. 자식이 태어날때엔 부모의 기본생성자를 호출하는 조건이 무조건인건지 궁금합니다. 태어난다는 기준도 public 이후에 자식이 호출되는 순간이 태어나는건지.. 제가 이해를 잘 못하다 보니 혹시 추가 설명을 해주실 수 있을까요? 정리하면 Java에서 자식이 태어난다는 기준이 public 후 생성자로 기능을 시작할 때 태어나는 것인지. super(매개변수)를 통해 부모의 매개변수를 직접 명시하여 호출하지 않으면 자식이 태어나면서 무조건 부모의 기본생성자를 호출하는건지.' 위의 두가지 질문드립니다.
프로젝트 의존성에 implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' 즉, oauth2 의존성을 추가하면 프로젝트 실행시 콘솔에 스프링 시큐리티가 기본으로 제공하는 password가 안나오는데 oauth2 의존성을 제거하고 실행해보면 기본으로 제공하는 password가 콘솔에 나옵니다. 강의랑 다른거 같은데 이유가 뭘까요? 최신버전에 따른 차이인가요?
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 해당 문제가 발생합니다 아마 자바 버전 문제때문에 발생되는것같습니다. 혹시 위의 그림과같이 환경설정을 java23으로 했을시 수업내용을 따라가기가 어려울까요? 수업자료에 업데이트 되어있는 버전대로 진행해도 계속 첫번째 사진과 같은 에러가 나타납니다.ㅠ
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 5. 자바 예외 이해.pdf (v20231127) 6페이지에 MyUncheckedException이라고 써져 있는데 MyCheckedException으로 바꿔야 할 것 같습니다
t1 >> t3 t2 >> t3 이렇게 테스크를 연결했을때 case 1 : t1, t2 둘다 종료되어야 t3가 실행되는지 case 2 : t1이 종료되었을떄, t2가 종료되었을때 각각 t3가 한번씩 실행되는지 궁금합니다. 위의 방법과 [t1, t2] >> t3 가 동등하다고 설명해주셨는데 case 1, case2 두가지 방법을 설정하고싶을때는 어떻게 처리하면 될까요?
안녕하세요! 강의 잘 보고 있습니다. 강의를 보는 중에 헷갈리는 개념이 있어서 질문드려요! 올려주신 강의 중 미들웨어 챕터 부분을 보고 있어요. 그런데 문득 미들웨어와 uvicorn, gunicorn, hypercorn 과 같은 WSGI, ASGI 서버 간의 관계에 대해서 궁금증이 들었습니다. 보통 언어에 상관없이 웹 통신을 한다라고 하면 아래와 같은 구조로 통신한다고 볼 수 있잖아요?(DB가 있다고 가정) """ Client(Web Browser) ---> Web Server ---> Web Application Server ---> DB """ 그리고 파이썬에서는 uvicorn, gunicorn 과 같은 WSGI, ASGI 서버들이 Web Server 역할을, Flask, FastAPI 와 같은 프레임워크 서버들이 Web Application Server의 역할을 한다고 알고 있습니다. 그리고 저 Web Server 요소가 미들웨어라고 정의한다고 알고 있었는데요! 그런데 FastAPI 공식문서 상 에서는 미들웨어라는 것을 소개할 때, "모든 요청 또는 응답에 대해서 사전 또는 사후 처리 로직을 추가할 때 사용하는 것" 이라고 소개를 하면서 문득 "그러면 여기서 이야기하는 미들웨어랑 uvicorn, gunicorn 과는 어떤 차이점이 있는거지?" 하면서 헷갈리더라구요. 자바에서는 미들웨어라는 개념이 JVM 위에서 동작하면서 DB 연결, TCP/IP 연결 등과 같이 다른 소프트웨어(ex.애플리케이션)가 잘 동작하도록 지원해주는 소프트웨어라고 알고 있는데요! 만약 이러한 관점에서 본다면 uvicorn, gunicorn 과 같은 WSGI 또는 ASGI 서버들도 미들웨어라고 볼 수는 없는 걸까요? ChatGPT 한테 물어보았을 때는 엄연히 다른 개념이라고 하는데.. 정확히 차이점을 잘 모르겠어서요. 답변 해주시면 감사하겠습니다! (참고로 저는 파이썬으로만 오랫동안 개발해와서 자바나 다른 언어 관련해서는 잘 모를 수도 있어서 다른 언어에 대한 비유로 답변 주시면 제가 잘 이해를 못할 수도 있습니다!)
MyException Class 오류발생 =>com.boot.sailing_jsp.v2.service.MenuSvcV2 rror Error Error Error : My Exception 처리 => [[ ### Error updating database. Cause: java.sql.SQLSyntaxErrorException: (conn=4058) Truncated incorrect DECIMAL value: '1>' ### The error may exist in file [C:\Users\mins1\OneDrive\Desktop\Sailing_jsp\build\resources\main\sqlmapper\v2\CoffeeMenuV2.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: Update coffee_menu set price = CAST(? as INTEGER) WHERE no in ( ? ) ### Cause: java.sql.SQLSyntaxErrorException: (conn=4058) Truncated incorrect DECIMAL value: '1>' ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: (conn=4058) Truncated incorrect DECIMAL value: '1>' ]] 이렇게 오류가 뜨는데 해결 못한지 3일째예요ㅠㅠ
안녕하세요, 영한님. 이번 강의 9분 10초쯤에 flag 와 count 변수에 volatile 키워드를 추가하셨는데, 저는 flag 변수에만 volatile 키워드를 사용해도 예제 코드가 정상적으로 동작할 것으로 예상했습니다. 실제로 flag 변수에만 volatile 키워드를 붙이고 실행해보니 main 스레드에서 가져온 task.count 와 work 스레드에서 가져온 count 의 값이 동일했습니다. 또한 volatile 키워드를 모두 사용하지 않았을 때를 기준으로 flag 변수에만 사용했을 때 약 2배, flag 와 count 변수 모두 사용했을 때 약 5배 정도 성능이 저하되는 것을 확인했습니다. 그럼에도 불구하고 count 에도 volatile 키워드를 사용하신 이유가 있을까요? 제가 생각하지 못한 예외 상황이 있을까요?
다른 분 질문의 답변을 봐도 이해가 잘 안되서 질문 남깁니다! 앞 포인터 강의에서 int *p = &n; printf("%d\n", p); 를 실행하면 n의 주소값이 출력된다고 이해했는데, char *str; printf("%s\n", str); 을 했을때는 왜 myString의 0번째 인덱스 주소값이 출력되는게 아니라 this is string 이 출력되는지 이해가 안되서요.. 설명해주시면 감사하겠습니다!
세션을 실행하고 있어 curl로 실행하려고 하는데 아래와 같은 에러 메세지가 뜨네요. Invoke-WebRequest : 매개 변수 이름 'c'이(가) 모호하므로 매개 변수를 처리할 수 없습니다. 일치하는 항목은 다음과 같습니다. -Credential -CertificateThumbprint -Certificate -ContentType. 위치 줄:1 문자:45 + curl -X POST http://127.0.0.1:8000/set/ -i -c cookies.txt + ~~실행하면 위와 같은 에러메시지가 나오는데 어떻게 해결할 수 있나요? from fastapi import FastAPI,Request from fastapi.security import HTTPBasic from starlette.middleware.sessions import SessionMiddleware app=FastAPI() app.add_middleware(SessionMiddleware,secret_key="your-secret-key") @app.post("/set/") async def set_session(request:Request): request.session["username"]='smith' return {"message":"Session value"} @app.get("/get/") async def get_session(request:Request): username=request.session.get("username","Guest") return {"username":username}
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오)네 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)네 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)네 [질문 내용] 여기에 질문 내용을 남겨주세요. 강의자료로 주신 내용그대로 작성후 서버실행하고 url입력하면 다음과 같이나타납니다. 어떻게 해결하나요?? jdk는 21쓰고 인텔리제이는 무료버전씁니다. jdk버전도 17도 바꿔보고, 인텔리제이 다시 깔아보고 하는데도 인식을 못하네요
새로운 Authentication 생성시에, public Authentication createNewAuthentication(Authentication currentAuth, String username) { UserDetails newPrincipal = this.loadUserByUsername(username); UsernamePasswordAuthenticationToken newAuth = new UsernamePasswordAuthenticationToken(newPrincipal, currentAuth.getCredentials(), newPrincipal.getAuthorities()); newAuth.setDetails(currentAuth.getDetails()); return newAuth; } 위 코드에 관하여 질문드립니다. currentAuth.getCredentials()는 현재 SecurityContext에 있는 Authentication의 비밀번호를 가져와서 newAuth생성에 쓰임으로 알고있는데요. 이 때, 비밀번호를 수정한 경우에는.. newPrincipal.getCredentials() 라고 고친 메서드를 써야할까요? 아니면 Authentication을 바꿔서 유지해주기보다 로그아웃시켜서 다시 로그인해주는 방식이 옳을까요?
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="hello.sailing_jsp.v2.dao.MenuDaoV2"> <!--조회--> <select id="doList" resultType="hello.sailing_jsp.v2.vo.Coffee_menu"> select no, coffee, kind, price, date_format(reg_day,'%Y,%m,%d') as reg_day, date_format(mod_day,'%y,%m,%d') as mod_day from coffee_menu </select> <!--검색에 의한 쿼리--> <select id="doSearch" resultType="hello.sailing_jsp.v2.vo.Coffee_menu"> select no, coffee, kind, price, date_format(reg_day,'%Y,%m,%d')as reg_day, date_format(mod_day,'%y,%m,%d')as mod_day from coffee_menu where 1=1 and reg_day >= date_format( #{strStartDate}, '%Y,%m,%d') and reg_day < date_add(date_format(#{strEndDate}, '%Y,%m,%d'), interval +1 day) <if test="strCoffee != 'ALL'"> and coffee like concat('%',#{strCoffee},'%') </if> <if test="strKind != 'ALL'"> and kind = #{strKind} </if> </select> <!--메뉴조회--> <select id="doListOne" resultType="java.util.Map"> select no, coffee, kind, price, date_format(reg_day,'%Y,%m,%d')as reg_day, date_format(mod_day,'%y,%m,%d')as mod_day from coffee_menu where no = cast(#{strNo} as Integer) </select> <insert id="doInsert"> Insert Into coffee_menu(coffee,kind,price) values(#{coffee},#{kind},cast(#{price} as Integer)) </insert> <update id="doUpdate"> update coffee_menu set coffee = #{coffee}, kind = #{kind}, price = cast(#{price} as Integer) where no = cast(#{no} as Integer) </update> <delete id="doDelete"> Delete from coffee_menu where no = cast(#{strNo} as Integer) </delete> <!--메뉴 가격 수정 입력--> <update id="doUpdatePrice"> update coffee_menu set price = cast(#{strPrice} as integer) where no = cast(#{strNo} as integer) </update> <!--가격 로그 입력--> <insert id="doInsertLog"> insert into coffee_menu_log(coffee_no, price) values( #{strNo}, cast(#{strPrice} as integer) ) </insert> <!--메뉴 가격 수정 원쿼리로 처리--> <update id="doUpdatePriceOne"> update coffee_menu set price = cast(#{strPrice} as integer) <where> <foreach item="item" index="index" collection="chkList" open="no in (" separator="," close=")" nullable="true"> #{item} </foreach> </where> </update> <!--가격 로그 입력 원쿼리--> <insert id="doInsertLogOne"> insert into coffee_menu_log(coffee_no, price) <foreach item="item" index="index" collection="chkList" separator="union all" nullable="true"> select #{item}, cast(#{strPrice} as integer) from dual </foreach> </insert> <!--boot 로그 입력--> <insert id="doBootLog"> insert into boot_log (class) values( #{strClass} ) </insert> </mapper> org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bootlog': Unsatisfied dependency expressed through field 'menuDaoV2'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'menuDaoV2' defined in file [C:\Users\mins1\OneDrive\Desktop\Sailing_jsp\build\classes\java\main\com\boot\sailing_jsp\v2\dao\MenuDaoV2.class]: Cannot resolve reference to bean 'sqlSessionTemplate' while setting bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionTemplate' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.i o.IOException: Failed to parse mapping resource: 'file [C:\Users\mins1\OneDrive\Desktop\Sailing_jsp\build\resources\main\sqlmapper\v2\CoffeeMenuV2.xml]'