묻고 답해요
156만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨스프링 핵심 원리 - 기본편
lombok 설치 시 에러
=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]롬복 설치 과정에서 수업 자료에 있는 코드에서 자바 버전이나 스프링 버전 부분만 제외하고 복붙을 했는데 알수없는 에러가 발생하네요 ㅠㅠ 코드 전체plugins { java id("org.springframework.boot") version "2.7.10" id("io.spring.dependency-management") version "1.0.15.RELEASE" } group = "hello" version = "0.0.1-SNAPSHOT" java.sourceCompatibility = JavaVersion.VERSION_11 //lombok 설정 추가 시작 configurations { compileOnly { extendsFrom annotationProcessor } } //lombok 설정 추가 끝 repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter' //lombok 라이브러리 추가 시작 compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' testCompileOnly 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok' //lombok 라이브러리 추가 끝 testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } } test { useJUnitPlatform() } 에러메시지C:\Users\USER\OneDrive\���� ȭ��\������\2. ������ �ٽ� ���� - �⺻��\core\build.gradle.kts:14:34: Expecting an element
-
미해결
Could not find javax.xml.bind:jsxb-api:.
java11, springboot2.7.1로 프로젝트 진행했던 프로젝트를 열어 실행하니 에러가 발생합니다.해결하지 못하여 질문드립니다!발생에러11:46:16 AM: Executing ':RandomApplication.main()'... > Task :compileJava FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.4.1/userguide/command_line_interface.html#sec:command_line_warnings 1 actionable task: 1 executed FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find javax.xml.bind:jsxb-api:. Required by: project : * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 652ms 11:46:16 AM: Execution finished ':RandomApplication.main()'.Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find javax.xml.bind:jsxb-api:. Required by: project : Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html시도java JDK 버전 확인, 빌드 자동 실행 설정 등.. 구글링해서 찾아봤으나 해결하지 못했습니다ㅠㅠ검색해보면 jaxb-api:. 를 기준으로 나오는데, 제 에러는 jsxb-api 입니다 이 둘의 차이는 무엇인가요?
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
zuul 강의에서 gradle로 하시는 분들을 위해 공유합니다
zuul을 사용하기 위해서는 spring boot 버전이 2.4보다 낮아야 한다고 해서 2.3.9.RELEASE를 사용했습니다. (2.4 미만 버전은 RELEASE가 붙더라고요)또한, spring boot 버전이 2.4 미만일 경우 spring cloud 2020.0.0 (2.4.x, 2.5.x 에서만 사용 가능) 버전을 사용할 수 없고 Hoxton 버전을 사용해야 됨을 적용했습니다.아래와 같이 해서 실행 성공했습니다.plugins { id 'java' id 'org.springframework.boot' version '2.3.9.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE' } group = 'com.example' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.RELEASE" } } tasks.named('test') { useJUnitPlatform() }
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
gradle 파일을 github에 push해도 상관없나요?
안녕하세요 좋은 강의 감사합니다!공부한 내용을 비공개 레포지토리에 업로드 하려고 합니다.아래 파일들이 .gitignore 파일에 추가안되있는데 이 파일들은 그대로 레포지토리에 업로드해도 괜찮은 건가요?
-
미해결스프링과 JPA 기반 웹 애플리케이션 개발
M1 mac 에서 gradle로 빌드하시려는 분들께 공유 하고싶어 글을 남겨요!
Requirementsstatic/node_module로 package.json에 선언된 의존성을 다운로드 받아야한다gradle build 시 package.json에 선언된 의존성을 확인하고 다시 다운로드 받아야 한다.뭔가 간단하게 끝내고 싶다 !!!Actionhttps://github.com/node-gradle/gradle-node-plugin/blob/master/docs/usage.md다양한 관련 플러그인 들이 있지만, 위의 플러그인을 설치 했습니다.2번의 요구사항은 gradle의 증분 컴파일(?)이 해주는 것 같습니다. (정확하지 않음 추측이에요)3번은 관련 자료를 찾던 도중 processResources 를 발견했고, Copies production resources into the production resources directory. 라고 설명 되어 있습니다.(공식 홈페이지)따라서, npm install 시 node_module 파일을 static 이하로 떨어 뜨리면 되겠구나!그리고 processResources를 "npm install 동작을하는 " Task를 의존하게 하면 되겠구나!-- 주석이 많아 가독성이 떨어지지만, 한번 읽어보시면 더 도움이 될거라 생각해서 위의 깃헙에 있는 주석 그대로 복사 붙여넣기 합니다. 수정한 부분은 nodeProjectDir 부분과processResources.dependsOn 부분 입니다.추가로 package.json 도 아래분이 잘 정리 해주셔서 함께 복사 붙여넣기 합니다.(고맙습니다!!)-인텔리제이 빌드시(gradle로 설정안했을 경우 동작안해요!)-gradle 탭 누르셔서 npm Task 들어오는지 확인해주세요!{ "name": "static", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "@yaireo/tagify": "^3.5.1", "bootstrap": "^4.4.1", "cropper": "^4.1.0", "font-awesome": "^4.7.0", "jdenticon": "^2.2.0", "jquery": "^3.4.1", "jquery-cropper": "^1.0.1", "mark.js": "^8.11.1", "moment": "^2.24.0", "summernote": "^0.8.16" } }plugins { id "com.github.node-gradle.node" version "3.5.0" id 'org.springframework.boot' version '2.7.5' id 'io.spring.dependency-management' version '1.0.15.RELEASE' id 'java' } group = 'me.studyOlle' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } node { // Whether to download and install a specific Node.js version or not // If false, it will use the globally installed Node.js // If true, it will download node using above parameters // Note that npm is bundled with Node.js download = true // Version of node to download and install (only used if download is true) // It will be unpacked in the workDir version = "16.14.0" // Version of npm to use // If specified, installs it in the npmWorkDir // If empty, the plugin will use the npm command bundled with Node.js npmVersion = "" // Version of Yarn to use // Any Yarn task first installs Yarn in the yarnWorkDir // It uses the specified version if defined and the latest version otherwise (by default) yarnVersion = "" // Base URL for fetching node distributions // Only used if download is true // Change it if you want to use a mirror // Or set to null if you want to add the repository on your own. distBaseUrl = "https://nodejs.org/dist" // Specifies whether it is acceptable to communicate with the Node.js repository over an insecure HTTP connection. // Only used if download is true // Change it to true if you use a mirror that uses HTTP rather than HTTPS // Or set to null if you want to use Gradle's default behaviour. allowInsecureProtocol = null // The npm command executed by the npmInstall task // By default it is install but it can be changed to ci npmInstallCommand = "install" // The directory where Node.js is unpacked (when download is true) workDir = file("${project.projectDir}/.gradle/nodejs") // The directory where npm is installed (when a specific version is defined) npmWorkDir = file("${project.projectDir}/.gradle/npm") // The directory where yarn is installed (when a Yarn task is used) yarnWorkDir = file("${project.projectDir}/.gradle/yarn") // The Node.js project directory location // This is where the package.json file and node_modules directory are located // By default it is at the root of the current project nodeProjectDir = file("${project.projectDir}/src/main/resources/static") // Whether the plugin automatically should add the proxy configuration to npm and yarn commands // according the proxy configuration defined for Gradle // Disable this option if you want to configure the proxy for npm or yarn on your own // (in the .npmrc file for instance) nodeProxySettings = ProxySettings.SMART } dependencies { // View Template Engine implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // Security implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' //Web implementation 'org.springframework.boot:spring-boot-starter-mail' implementation 'org.springframework.boot:spring-boot-starter-web' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.7.5' //Persistence implementation 'org.springframework.boot:spring-boot-starter-data-jpa' runtimeOnly 'com.h2database:h2' runtimeOnly 'com.mysql:mysql-connector-j' // LomBok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' // Dev developmentOnly 'org.springframework.boot:spring-boot-devtools' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' //Test Implementation testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' } tasks.named('test') { useJUnitPlatform() } processResources.dependsOn('npmInstall')
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
ERROR: JAVA_HOME is set to an invalid directory오류입니다
=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오) 네 스프링의 입문강의 중 빌드해보기파트입니다 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 같은 오류지만 저와 다른 경우였습니다. 다른 분의 경우는 환경변수에서 JAVA_HOME경로에 bin을 넣으셔서 생기신건데 저는 bin을 넣지않았습니다.3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) 넵[질문 내용]여기에 질문 내용을 남겨주세요. window cmd로 gradlew build를 실행했는데 s\Microsoft VS Code\bin C:\Users\WD\Desktop\project\hello-spring\hello-spring>gradlew ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_91 Please set the JAVA_HOME variable in your environment to match the location of your Java installation. 이렇게 떴습니다. 구글링했을때 환경변수에서 bin이 있으면 삭제하라는 방법과 ;을 삭제하라는 방법을 봤지만 저의 경우와 달라 질문드립니다. 현재 환경변수입니다 JAVA_HOME 은C:₩Program Files₩Zulu₩zulu-11 path에는 %JAVA_HOME%\bin경로를 추가하였습니다. 제가 생각하기로는 프로젝트파일을 바탕화면에 만들고 사용해서 혹시 오류가 생긴게 아닐까 생각하는데 확실하게 알고싶고 해결하고 싶어서 질문드립니다.
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
인텔리제이 세팅에 gradle이 없어서 진행을 못하고있습니다
안녕하세요. DataResourceUtil이 적용이안되서 gradle 설정부터 다시 하려고하는데, 스크린샷에 보시다시피 gradle 설정이 없습니다. 이건 어떻게 임포트해야하나요?
-
미해결
gradle build 중 complieJava 멈춤현상
안녕하세요. ec2 로 인스턴스를 생성 후 git 에 있는 springboot 기반의 프로젝트를 clone 후 .jar 로 배포를 시키려던 참이였습니다. ec2에는 openjdk11, mysql-server, git 설치 후 clone을 진행하고, 프로젝트 내부에 gradlew 파일에 chmod로 777 권한을 주고 build 를 진행시켰습니다. 보통 전에 하던 프로젝트는 빌드시간이 1분채 걸리지 않았는데, build 중에 complieJava 에서 지금 45분째 넘어가지 않고, 서버가 멈춘듯 합니다. 어떤 문제를 살펴봐야 할까요?
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
gradle 프로젝트 open 오류 발생
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용] 처음으로 mac 환경에서 프로젝트를 열려고 하는데 이 오류 때문에 진행을 못하고 있네요.. 프로젝트 파일을 다시 삭제하고 열어봐도 pc를 재부팅하고 다시 시작해도 똑같은 오류가 계속 발생합니다. 구글링에 검색해봐도 마땅한 해결방안이 나오지 않아 답답하네요ㅜㅜ 프로젝트 구성도 이상합니다.. 파일을 열때마다 "._java"와 같은 텍스트 파일이 생겨요
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
gradle 설정관련 질문입니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예 맞습니다2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 네 없는 네용입니다.3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 전부 확인했습니다.[질문 내용]안녕하세요. 선생님의 강의를 보면서 스프링을 배워가는 학생입니다. 처음 인텔리제이와 gradle 설치 이후 sdk관련된 gradle 싱크 문제로 큰고생 후 이제 설정이 완료되었다고 생각했는데 저는 선생님처럼 gradle 칸을 열어도 dependency 부분이 보이지 않습니다. 또한 hello-spring.build부분도 색깔로 처리되어서 메소드등이 인식되는것이 아니라 회색 밑줄로만 표시되는데요 이부분도 제대로된 세팅법을 알고 싶습니다. 기본적인 세팅부분인지라 질문에 등록되지 않았던 부분인것 같은데 해결책을 알 수가 없네요..
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
'plugins' cannot be applied to '(groovy.lang.Closure)' 관련 오류
안녕하세요. 질문글에서도 저같은 오류는 확인이 안되고, 인터넷에서도 도무지 모르겠어서 여기에 질문 드립니다. build.gradle에서 plugins 안에 id랑 dependencies 안에 implementation이 비활성화 점선줄이 그어져있구 실제로 import등 적용이 되지 않는 것 같아요. (그래서 @Transactional 등의 디비 관련된 애들이 import가 안돼요) java버전은 11이고, gradle버전은 제가 막 설정한 기억은 없는데, distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip 으로 나와있습니다. 제발 도움 좀 주세요... 실행이 되지 않아서 진도를 나아갈 수가 없습니다ㅠㅠ
-
미해결실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
Could not find querydslplugin 문제 (해결완료)
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용] 아래 처럼 에러가 뜹니다.Could not find gradle.plugin.com.ewerk.gradle.plugins:querydslplugin:1.0.10 로딩이 안되네요. buildscript { dependencies { classpath("gradle.plugin.com.ewerk.gradle.plugins:querydslplugin:1.0.10") }}plugins { id 'org.springframework.boot' version '2.6.1' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java'}apply plugin: "com.ewerk.gradle.plugins.querydsl"
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
intellij 실행버튼으로 서버 실행 vs gradlew 빌드 후 실행 차이점
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]안녕하세요, 스프링 입문 강의를 듣다가 빌드 관련 궁금한 점이 생겨서 질문합니다. 인텔리제이에서 실행 버튼을 눌러서 서버를 실행하는 것과 gradle 빌드를 해서 실행을 하는 것의 차이점이 궁금합니다. 또, 인텔리제이 settings > Build,Execution,Deployment에서 gradle로 실행할지 intellij로 실행할지 선택이 가능하던데 만약 여기서 gradle을 선택하면 인텔리제이 실행버튼을 누를 때 자동으로 gradle을 빌드하고 실행하는 건가요??
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
gradle build 할 때 질문이요
안녕하세요 제가 jpa 연동 부분 수강하고 있는데 build.gradle 에서 spring-boot-starter-test 부분이 기존에 아래와 같았었는데 방법 1. testImplementation'org.springframework.boot:spring-boot-starter-test' 이 상태에서는 아래와 같은 에러가 발생했는데 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] 제가 spring-boot-starter-test 부분을 다음과 같이 수정하고 실행하니까 에러가 사라졌습니다. 방법 2. testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'} 그런데 의문이든 부분이 방법2. 로 한뒤 Reload All Gradle Project 로 고치고 프로젝트를 실행하고 나서 에러가 발생하지 않고 정상 작동 됐는데 다시 방법1. 로 하고 Reload All Gradle Project로 고치고 실행 했는데 오류 없이 정상 작동합니다.. 그러면 의문이 방법2. 로 Reload 하고 다시 방법1. 로 Reload 해도 방법2로 한 부분이 gradle에 남아 있는 건가요??
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
Plugin [id: 'org.springframework.boot~ ] was not found in any of the following sources: 발생
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (아니오) // 참고했으나 해결 실패했습니다.3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]spring initializer를 통해 project를 다운받아 intellij에서 open 하였습니다. gradle을 최초 init하는 과정에서 아래와 같은 에러가 발생합니다. 에러 내용과 제 설정을 전달 드립니다. 같이 도움 한 번 부탁드리겠습니다. [아래] Build file 'C:\Users\201910002\IdeaProjects\BATCHINIT\build.gradle' line: 2 Plugin [id: 'org.springframework.boot', version: '2.6.0'] was not found in any of the following sources: * Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.springframework.boot', version: '2.6.0'] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.0') Searched in the following repositories: Gradle Central Plugin Repository ... 이하 152라인 더불어 EVENT LOG는 다음과 같습니다. [다음] Gradle sync failed: Plugin [id: 'org.springframework.boot', version: '2.6.0'] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.0') Searched in the following repositories: Gradle Central Plugin Repository (380 ms) settings는 아래처럼 설정하였습니다.
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
build가 완료되었는데 jar파일에 접근할 수 없다고 나옵니다.
안녕하세요. build 까지 실행되고 jar파일을 실행하려는데 아래와 같은 에러코드가 나오면서 실행이 되지 않습니다. Error: Unable to access jarfile hello-spring-0.0.1-SNAPSHOT 위 처럼 빌드는 실행되었으나 이렇게 jarfile에 접근할 수 없다고 나옵니다.. java 버전은 11로 모두 맞춰놓은 상태입니다. 기타 설정화면도 같이 첨부드립니다. java - versionjavac -version 결과화면 인텔리제이 설정화면입니다. 확인 부탁드리겠습니다. 감사합니다!
-
미해결스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
hello서블릿 강의 중 - response 객체가 예제와 다르게 나오는 경우...
[질문 내용]안녕하세요. 강의를 계속 진행하고 있는데 질문 사항이 있어서 문의를 드리고자 합니다. 개발 환경은 다음과 같습니다. IDE : sts-3.9.17 release jdk : jdk 11 (순정) build.gradle 설정 ---- plugins { id 'org.springframework.boot' version '2.5.7' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' id 'war' } group = 'hello' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' testImplementation 'org.springframework.boot:spring-boot-starter-test' } test { useJUnitPlatform() } 소스 코드 @WebServlet(name="helloServlet", urlPatterns = "/hello") public class HelloServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("HelloServlet.service"); System.out.println("request = " + request); System.out.println("response = " + response ); String username = request.getParameter("username"); System.out.println("username = "+username); response.setContentType("text/plain"); response.setCharacterEncoding("utf-8"); response.getWriter().write("hello " + username); } } 여기서 response 객체를 콘솔에 찍어서 확인을 해보았는데... 강사님 처럼 facade 형태로 나오는 것이 아닌 다른 형태로 나오는데, 이게 크게 문제가 있는걸까요?? 콘솔 출력 결과 HelloServlet.service request = org.apache.catalina.connector.RequestFacade@7a193b44 response = org.springframework.boot.web.servlet.support.ErrorPageFilter$ErrorWrapperResponse@6ac4205b username = 김 혹시 어느 부분에서 잘못된것이 있는지... 답변을 부탁드리고자 합니다. 감사합니다.
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
gradle build 관련
Windows 10 환경이고, interllij terminal에서 gradlew build 를 하면 위와 같은 에러가 뜹니다.Project Structure 의 SDK나 JAVA 환경 변수, Settings의 Java Compiler, gradle JVM 도 모두 11 버전으로 맞춰 두었는데 저런 오류가 뜹니다 (java --version도 11이 뜹니다ㅠㅠ) 답답해서 git bash 로 ./gradlew build 를 했더니 build가 잘 되네요...;; Windows 10 cmd로 .\gradlew build를 하면 잘 됩니다 인텔리제이 터미널만 사용하면 저런 에러가 뜨면서 빌드가 안되는데, 혹시 관련해서 아는게 있으시다면 답변 부탁드립니다! ㅠㅠ 인텔리제이 터미널에서 .\gradlew build --debug 시 출력되는 로그도 첨부합니다.
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
gradle 빌드에러
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용] intellij community, spring initializr 를 설치하고 gradle을 빌드하는데 이처럼 에러가 발생합니다..ㅜㅜ 해결방법 알려주시면 정말 감사드리겠습니다ㅠㅠ Gradle could not start your build. > Could not create service of type CrossBuildFileHashCache using BuildSessionServices.createCrossBuildFileHashCache(). > Failed to create parent directory 'C:\Users\mvc1\.gradle' when creating directory 'C:\Users\mvc1\.gradle\7.2\fileHashes' * Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Exception is: org.gradle.initialization.exception.InitializationException: Gradle could not start your build. Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of type CrossBuildFileHashCache using BuildSessionServices.createCrossBuildFileHashCache(). Caused by: org.gradle.api.UncheckedIOException: Failed to create parent directory 'C:\Users\mvc1\.gradle' when creating directory 'C:\Users\mvc1\.gradle\7.2\fileHashes'
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
Gradle 테스트와 빌드 질문
Gradle에서 build를 할 경우 특별한 설정을 하지 않으면 test 코드를 사용하여 test가 통과해야만 build를 하더라구요. 그런데 본 강의에서 사용한 테스트 코드 같이 Mock 객체를 쓰지 않고 Spring 기능을 포함한 테스트 코드의 경우는 DB가 동작 중이거나 하지 않으면 test를 통과하지 못하고 build에 실패하는 문제가 있네요. Build를 할 때에는 이런 test 코드를 제외하는 것이 맞나요? 그런데 test 코드를 넣어야 잘못된 코드가 배포되는 것을 막을 수 있을 것이고 테스트 코드의 필요성은 있다고 생각합니다. 그렇다면 Mock 객체 등을 사용하여 외부 환경에 의존하지 않는 test 코드를 새로 짜는 것이 맞나요? Jenkins 등으로 배포를 할 때에도 프로젝트 내의 test 코드를 돌리는 것으로 알고 있는데 실제 업무 시에는 테스트 코드를 어떻게 짜고 있는지도 알려주시면 감사하겠습니다.