월 66,000원
5개월 할부 시다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
안녕하세요 리펙토링에 대해 질문드립니다.!
안녕하세요 좋은강의에 먼저 감사드립니다 제 질문은 processNewAccount(SignUpForm signUpForm)을 사용할 때 서비스레이어에서는 SignUpForm이 아닌 Account를 받는 것은 어떠한지 여쭙고 싶습니다.SignUpForm이 단순 정보만 전달하는 객체라 굳이 서비스레이어가 모르게할 필요가 있을까도 하지만 혹 서비스레이어에서 SignUpForm도 모르게 하는게 좋을지 궁금합니다!
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
findByEmail로 조회가 되는 이유
안녕하세요 강의 보면서 따라하는 와중에 아직 DB연결을 하지 않았는데 조회가 되는이유가 문득 궁금해져서 글을 남깁니다. 내부적으로 h2 database가 디폴트로 동작해서 해당하는 Account Entitiy클래스로 테이블이 생성되고 조회가 되는것이라 생각이 드는데 맞을까요?
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
mockMvc를 찾을 수 없다고 나옵니다!
Could not autowire. No beans of 'MockMvc' type found. pom.xml에 포함되어 있어서 라이브러리 받고 import 까지 되었는 데 위와 같이 뜨는 현상에 대해 질문드립니다!
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
Ctrl+f9 빌드에 관해서 질문입니다.
안녕하세요 선생님 선생님은 settings/profile에서 새로고침을 누르셔도 login 페이지로 안넘어 가시던데 제가 인메모리 h2 db를 써서 그런건가요? 아래는 build 누른 시점부터 찍히는 로그입니다. h2를 껐다 켜서 로그인정보가 다 날아간것 같습니다. 아니면 제가 뭔가 다른 실수를 한게 있을까요? 2022-07-23 12:44:18.358 INFO 11819 --- [ Thread-7] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2022-07-23 12:44:18.359 INFO 11819 --- [ Thread-7] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' 2022-07-23 12:44:18.561 WARN 11819 --- [ Thread-7] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-214] 2022-07-23 12:44:18.563 INFO 11819 --- [ Thread-7] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown initiated... 2022-07-23 12:44:18.577 INFO 11819 --- [ Thread-7] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown completed. . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.7.1) 2022-07-23 12:44:18.621 INFO 11819 --- [ restartedMain] com.StudyCafe_R.StudyCafe_R.App : Starting App using Java 11.0.14 on tony-dev-pc with PID 11819 (/home/tony/vscode/StudyCafe_R/build/classes/java/main started by tony in /home/tony/vscode/StudyCafe_R) 2022-07-23 12:44:18.621 INFO 11819 --- [ restartedMain] com.StudyCafe_R.StudyCafe_R.App : The following 1 profile is active: "local" 2022-07-23 12:44:18.708 INFO 11819 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2022-07-23 12:44:18.712 INFO 11819 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 3 ms. Found 1 JPA repository interfaces. 2022-07-23 12:44:18.756 INFO 11819 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2022-07-23 12:44:18.757 INFO 11819 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2022-07-23 12:44:18.757 INFO 11819 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.64] 2022-07-23 12:44:18.762 INFO 11819 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2022-07-23 12:44:18.762 INFO 11819 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 140 ms 2022-07-23 12:44:18.767 INFO 11819 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-3 - Starting... 2022-07-23 12:44:18.769 INFO 11819 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-3 - Start completed. 2022-07-23 12:44:18.769 INFO 11819 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:57d02fcf-bc77-4b9d-a458-af74c8af958b' 2022-07-23 12:44:18.779 WARN 11819 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Cannot deserialize session attribute [SPRING_SECURITY_CONTEXT] for session [9D571E53AB4D3E439BDA725FFD381C3E] 2022-07-23 12:44:18.786 INFO 11819 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2022-07-23 12:44:18.789 INFO 11819 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2022-07-23 12:44:18.821 INFO 11819 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2022-07-23 12:44:18.821 INFO 11819 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2022-07-23 12:44:18.868 WARN 11819 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2022-07-23 12:44:18.873 INFO 11819 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index 2022-07-23 12:44:18.896 INFO 11819 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@1297ed15, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@50c40432, org.springframework.security.web.context.SecurityContextPersistenceFilter@8027741, org.springframework.security.web.header.HeaderWriterFilter@74f31289, org.springframework.security.web.csrf.CsrfFilter@133775ab, org.springframework.security.web.authentication.logout.LogoutFilter@4eca5019, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@1ee33650, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1fd2f745, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@73d9d96c, org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter@645db284, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5712f9cc, org.springframework.security.web.session.SessionManagementFilter@20b0d4d1, org.springframework.security.web.access.ExceptionTranslationFilter@39f5c652, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@4a81020f] 2022-07-23 12:44:18.897 WARN 11819 --- [ restartedMain] o.s.s.c.a.web.builders.WebSecurity : You are asking Spring Security to ignore Mvc [pattern='/node_modules/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead. 2022-07-23 12:44:18.897 INFO 11819 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Will not secure Mvc [pattern='/node_modules/**'] 2022-07-23 12:44:18.897 WARN 11819 --- [ restartedMain] o.s.s.c.a.web.builders.WebSecurity : You are asking Spring Security to ignore org.springframework.boot.autoconfigure.security.servlet.StaticResourceRequest$StaticResourceRequestMatcher@53e17a1c. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead. 2022-07-23 12:44:18.897 INFO 11819 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Will not secure org.springframework.boot.autoconfigure.security.servlet.StaticResourceRequest$StaticResourceRequestMatcher@53e17a1c 2022-07-23 12:44:18.925 INFO 11819 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2022-07-23 12:44:18.932 INFO 11819 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2022-07-23 12:44:18.935 INFO 11819 --- [ restartedMain] com.StudyCafe_R.StudyCafe_R.App : Started App in 0.326 seconds (JVM running for 94.183) 2022-07-23 12:44:18.936 INFO 11819 --- [ restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged 2022-07-23 12:44:32.035 INFO 11819 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2022-07-23 12:44:32.036 INFO 11819 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2022-07-23 12:44:32.037 INFO 11819 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
ArchUnit test 질문입니다.
안녕하세요. 백기선님. 유익한 강의 만들어주셔서 감사합니다. 저는 현재 패키지 구조 ArchUnit Test 부분을 수강하고 있습니다. 강좌에서 인텔리제이를 활용해 @ArchTest 어노테이션으로 해당 문제점을 빠르게 콘솔로 확인할 수 있는 것을 보고 제가 사용중인 VSCODE에서 진행했더니 테스트 성공/실패 결과는 볼 수 있으나 어디가 문제인지는 알려주지 않았습니다. 해서 여러 문서들을 보고 Junit 테스트 코드 때 사용했던 코드들을 바탕으로 해서 ArchRule을 만들어 마지막 check 메소드를 호출해 테스트 하니 결과를 받아볼 수 있었습니다. VSCODE에서 ArchUnit에 대한 디버깅 방법을 구하고자 하는 것이 아니라, 문법은 틀리나 같은 테스트 코드라고 생각이 되어 돌린 이 테스트 코드에 대해서 말씀드립니다. @ArchTest 에서는 성공하였으나, Junit 쪽에서는 실패로 나타나 해당 이유가 궁금해 질문드립니다. 아래 관련파일 첨부합니다. < 실패한 JUNIT > <오류내용> java.lang.AssertionError: Architecture Violation [Priority: MEDIUM] - Rule 'slices matching 'com.study.inf.modules.(*)..' should be free of cycles' was violated (1 times):Cycle detected: Slice account -] Slice settings -] Slice accountDependencies of Slice accountMethod [com.study.inf.modules.account.AccountService.updateNotifications(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.Notifications)] has parameter of type [com.study.inf.modules.settings.forms.Notifications] in (AccountService.java:0)Method [com.study.inf.modules.account.AccountService.updateProfile(com.study.inf.modules.account.Account, com.study.inf.modules.settings.validator.Profile)] has parameter of type [com.study.inf.modules.settings.validator.Profile] in (AccountService.java:0)Dependencies of Slice settingsConstructor [com.study.inf.modules.settings.SettingsController.[init](com.study.inf.modules.account.AccountService, org.modelmapper.ModelMapper, com.study.inf.modules.settings.validator.NicknameValidator, com.study.inf.modules.tag.TagService, com.study.inf.modules.tag.TagRepository, com.study.inf.modules.zone.ZoneRepository, com.fasterxml.jackson.databind.ObjectMapper)] has parameter of type [com.study.inf.modules.account.AccountService] in (SettingsController.java:0)Constructor [com.study.inf.modules.settings.WithAccountSecurityContextFactory.[init](com.study.inf.modules.account.AccountService)] has parameter of type [com.study.inf.modules.account.AccountService] in (WithAccountSecurityContextFactory.java:0)Constructor [com.study.inf.modules.settings.validator.NicknameValidator.[init](com.study.inf.modules.account.AccountRepository)] has parameter of type [com.study.inf.modules.account.AccountRepository] in (NicknameValidator.java:0)Field [com.study.inf.modules.settings.SettingsController.accountService] has type [com.study.inf.modules.account.AccountService] in (SettingsController.java:0)Field [com.study.inf.modules.settings.SettingsControllerTest.accountRepository] has type [com.study.inf.modules.account.AccountRepository] in (SettingsControllerTest.java:0)Field [com.study.inf.modules.settings.SettingsControllerTest.accountService] has type [com.study.inf.modules.account.AccountService] in (SettingsControllerTest.java:0)Field [com.study.inf.modules.settings.WithAccountSecurityContextFactory.accountService] has type [com.study.inf.modules.account.AccountService] in (WithAccountSecurityContextFactory.java:0)Field [com.study.inf.modules.settings.validator.NicknameValidator.accountRepository] has type [com.study.inf.modules.account.AccountRepository] in (NicknameValidator.java:0)Method [com.study.inf.modules.settings.SettingsController.addTag(com.study.inf.modules.account.Account, com.study.inf.modules.tag.TagForm)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.addZone(com.study.inf.modules.account.Account, com.study.inf.modules.zone.ZoneForm)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.removeTag(com.study.inf.modules.account.Account, com.study.inf.modules.tag.TagForm)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.removeZone(com.study.inf.modules.account.Account, com.study.inf.modules.zone.ZoneForm)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateAccount(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.NicknameForm, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateAccountForm(com.study.inf.modules.account.Account, org.springframework.ui.Model)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateNotifications(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.Notifications, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateNotificationsForm(com.study.inf.modules.account.Account, org.springframework.ui.Model)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updatePassword(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.PasswordForm, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updatePasswordForm(com.study.inf.modules.account.Account, org.springframework.ui.Model)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateProfile(com.study.inf.modules.account.Account, com.study.inf.modules.settings.validator.Profile, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateProfileForm(com.study.inf.modules.account.Account, org.springframework.ui.Model)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateTags(com.study.inf.modules.account.Account, org.springframework.ui.Model)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.SettingsController.updateZonesForm(com.study.inf.modules.account.Account, org.springframework.ui.Model)] has parameter of type [com.study.inf.modules.account.Account] in (SettingsController.java:0)Method [com.study.inf.modules.settings.WithAccountSecurityContextFactory.createSecurityContext(com.study.inf.modules.settings.WithAccount)] calls constructor [com.study.inf.modules.account.form.SignUpForm.[init]()] in (WithAccountSecurityContextFactory.java:26)Method [com.study.inf.modules.settings.WithAccountSecurityContextFactory.createSecurityContext(com.study.inf.modules.settings.WithAccount)] calls method [com.study.inf.modules.account.form.SignUpForm.setNickname(java.lang.String)] in (WithAccountSecurityContextFactory.java:27)Method [com.study.inf.modules.settings.WithAccountSecurityContextFactory.createSecurityContext(com.study.inf.modules.settings.WithAccount)] calls method [com.study.inf.modules.account.form.SignUpForm.setEmail(java.lang.String)] in (WithAccountSecurityContextFactory.java:28)Method [com.study.inf.modules.settings.WithAccountSecurityContextFactory.createSecurityContext(com.study.inf.modules.settings.WithAccount)] calls method [com.study.inf.modules.account.form.SignUpForm.setPassword(java.lang.String)] in (WithAccountSecurityContextFactory.java:29)Method [com.study.inf.modules.settings.WithAccountSecurityContextFactory.createSecurityContext(com.study.inf.modules.settings.WithAccount)] calls method [com.study.inf.modules.account.AccountService.processNewAccount(com.study.inf.modules.account.form.SignUpForm)] in (WithAccountSecurityContextFactory.java:30)Method [com.study.inf.modules.settings.validator.NicknameValidator.validate(java.lang.Object, org.springframework.validation.Errors)] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (NicknameValidator.java:31)Method [com.study.inf.modules.settings.WithAccountSecurityContextFactory.createSecurityContext(com.study.inf.modules.settings.WithAccount)] calls method [com.study.inf.modules.account.AccountService.loadUserByUsername(java.lang.String)] in (WithAccountSecurityContextFactory.java:33)Method [com.study.inf.modules.settings.SettingsControllerTest.afterEach()] calls method [com.study.inf.modules.account.AccountRepository.deleteAll()] in (SettingsControllerTest.java:70)Method [com.study.inf.modules.settings.SettingsController.updateProfile(com.study.inf.modules.account.Account, com.study.inf.modules.settings.validator.Profile, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] calls method [com.study.inf.modules.account.AccountService.updateProfile(com.study.inf.modules.account.Account, com.study.inf.modules.settings.validator.Profile)] in (SettingsController.java:98)Method [com.study.inf.modules.settings.SettingsControllerTest.addZone()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:98)Method [com.study.inf.modules.settings.SettingsControllerTest.addZone()] calls method [com.study.inf.modules.account.Account.getZones()] in (SettingsControllerTest.java:100)Method [com.study.inf.modules.settings.SettingsControllerTest.removeZone()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:107)Method [com.study.inf.modules.settings.SettingsControllerTest.removeZone()] calls method [com.study.inf.modules.account.AccountService.addZone(com.study.inf.modules.account.Account, com.study.inf.modules.zone.Zone)] in (SettingsControllerTest.java:109)Method [com.study.inf.modules.settings.SettingsController.updatePassword(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.PasswordForm, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] calls method [com.study.inf.modules.account.AccountService.updatePassword(com.study.inf.modules.account.Account, java.lang.String)] in (SettingsController.java:118)Method [com.study.inf.modules.settings.SettingsControllerTest.removeZone()] calls method [com.study.inf.modules.account.Account.getZones()] in (SettingsControllerTest.java:120)Method [com.study.inf.modules.settings.SettingsController.updateNotifications(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.Notifications, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] calls method [com.study.inf.modules.account.AccountService.updateNotifications(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.Notifications)] in (SettingsController.java:138)Method [com.study.inf.modules.settings.SettingsController.updateTags(com.study.inf.modules.account.Account, org.springframework.ui.Model)] calls method [com.study.inf.modules.account.AccountService.getTags(com.study.inf.modules.account.Account)] in (SettingsController.java:147)Method [com.study.inf.modules.settings.SettingsControllerTest.addTag()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:149)Method [com.study.inf.modules.settings.SettingsControllerTest.addTag()] calls method [com.study.inf.modules.account.Account.getTags()] in (SettingsControllerTest.java:150)Method [com.study.inf.modules.settings.SettingsControllerTest.removeTag()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:157)Method [com.study.inf.modules.settings.SettingsControllerTest.removeTag()] calls method [com.study.inf.modules.account.AccountService.addTag(com.study.inf.modules.account.Account, com.study.inf.modules.tag.Tag)] in (SettingsControllerTest.java:159)Method [com.study.inf.modules.settings.SettingsController.addTag(com.study.inf.modules.account.Account, com.study.inf.modules.tag.TagForm)] calls method [com.study.inf.modules.account.AccountService.addTag(com.study.inf.modules.account.Account, com.study.inf.modules.tag.Tag)] in (SettingsController.java:160)Method [com.study.inf.modules.settings.SettingsControllerTest.removeTag()] calls method [com.study.inf.modules.account.Account.getTags()] in (SettingsControllerTest.java:161)Method [com.study.inf.modules.settings.SettingsControllerTest.removeTag()] calls method [com.study.inf.modules.account.Account.getTags()] in (SettingsControllerTest.java:172)Method [com.study.inf.modules.settings.SettingsController.removeTag(com.study.inf.modules.account.Account, com.study.inf.modules.tag.TagForm)] calls method [com.study.inf.modules.account.AccountService.removeTag(com.study.inf.modules.account.Account, com.study.inf.modules.tag.Tag)] in (SettingsController.java:173)Method [com.study.inf.modules.settings.SettingsController.updateZonesForm(com.study.inf.modules.account.Account, org.springframework.ui.Model)] calls method [com.study.inf.modules.account.AccountService.getZones(com.study.inf.modules.account.Account)] in (SettingsController.java:181)Method [com.study.inf.modules.settings.SettingsControllerTest.updateAccount_success()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:197)Method [com.study.inf.modules.settings.SettingsController.addZone(com.study.inf.modules.account.Account, com.study.inf.modules.zone.ZoneForm)] calls method [com.study.inf.modules.account.AccountService.addZone(com.study.inf.modules.account.Account, com.study.inf.modules.zone.Zone)] in (SettingsController.java:198)Method [com.study.inf.modules.settings.SettingsController.removeZone(com.study.inf.modules.account.Account, com.study.inf.modules.zone.ZoneForm)] calls method [com.study.inf.modules.account.AccountService.removeZone(com.study.inf.modules.account.Account, com.study.inf.modules.zone.Zone)] in (SettingsController.java:210)Method [com.study.inf.modules.settings.SettingsController.updateAccount(com.study.inf.modules.account.Account, com.study.inf.modules.settings.forms.NicknameForm, org.springframework.validation.Errors, org.springframework.ui.Model, org.springframework.web.servlet.mvc.support.RedirectAttributes)] calls method [com.study.inf.modules.account.AccountService.updateNickname(com.study.inf.modules.account.Account, java.lang.String)] in (SettingsController.java:229)Method [com.study.inf.modules.settings.SettingsControllerTest.updateProfile()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:237)Method [com.study.inf.modules.settings.SettingsControllerTest.updateProfile()] calls method [com.study.inf.modules.account.Account.getBio()] in (SettingsControllerTest.java:238)Method [com.study.inf.modules.settings.SettingsControllerTest.updateProfile_error()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:255)Method [com.study.inf.modules.settings.SettingsControllerTest.updateProfile_error()] calls method [com.study.inf.modules.account.Account.getBio()] in (SettingsControllerTest.java:256)Method [com.study.inf.modules.settings.SettingsControllerTest.updatePassword_success()] calls method [com.study.inf.modules.account.AccountRepository.findByNickname(java.lang.String)] in (SettingsControllerTest.java:281)Method [com.study.inf.modules.settings.SettingsControllerTest.updatePassword_success()] calls method [com.study.inf.modules.account.Account.getPassword()] in (SettingsControllerTest.java:282) at com.tngtech.archunit.lang.ArchRule$Assertions.assertNoViolation(ArchRule.java:92) at com.tngtech.archunit.lang.ArchRule$Assertions.check(ArchRule.java:82) at com.tngtech.archunit.lang.ArchRule$Factory$SimpleArchRule.check(ArchRule.java:196) at com.tngtech.archunit.lang.syntax.ObjectsShouldInternal.check(ObjectsShouldInternal.java:81) at com.tngtech.archunit.library.dependencies.SliceRule.check(SliceRule.java:64) at com.study.inf.modules.ArchUnitTestCode.slice(ArchUnitTestCode.java:55) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
비영속성 객체 질문드립니다.
accountService.addZone(account, ?)? 에 z1, z2 어떠한 객체를 넣어도 위의 기능은 잘 작동합니다. 이유는 addZone()에서 account 엔티티를 불러와 영속 상태이므로 변경감지를 통해 바뀌는 것으로 이해했습니다. Account객체에 원하는 zone을 넣은 후 post로 원하는 zone을 삭제 하면 z1으로 넣은 경우 문제가 없었으나, z2는 삭제가 되지 않고 에러가 발생하는 것을 확인했습니다. 이에 대한 저의 추측은 1. z1은 영속성 객체이나, z2는 비영속성 객체이다.2. .addZone(account, z2); 에 들어간 z2와 post에 들어간 zoneForm으로 찾아낸 Zone 객체는 서로 같은 toString 문자열을 가지고 있으나 다르다.3. z2는 계속 비영속성 객체이지만 zoneForm은 영속성 객체로 바뀐다. 결국 z2는 임의로 준 값을 가지고 있으며, z1은 zoneRepoitory에 저장되어 있는 엔티티 값을 가져온다.post에 들어간 zoneForm 또한 zoneRepoitory에서 찾아온 Zone 객체를 가지고 오기 때문에 서로 같은 엔티티 객체인 z1은 삭제가 되지만 z2는 삭제되지 않는다. 이러한 방식으로 이해했는데 이해가 잘못됐거나, 설명에 문제가 있다면 지적해주시면 감사하겠습니다..addZone()에서 z2가 들어간 "account"는 영속성 객체이지만, account.getZone()으로 들어간 "z2"는 비영속성 객체로 이해하면 될까요...?
- 해결됨스프링과 JPA 기반 웹 애플리케이션 개발
패스워드 수정 테스트 시 현재 인증된 사용자의 email, nickname 값을 mockMvc Parameter로 전달하는 방법에 대한 질문입니다.
안녕하세요. 이 질문은 이전에 제가 등록했던 https://www.inflearn.com/questions/595640와 연관지어 질문드립니다. '입력값 정상' 케이스의 패스워드 수정 테스트 코드를 아래와 같이 작성해 보았습니다. 위 코드에서 @WithAccount(value = "henu") 어노테이션을 통해 'value 값'을 통해 닉네임과 이메일(value + "@email.com")로 회원 정보를 생성하고, 이를 SecurityContext에 Authentication으로 넣어줌으로써 MockMvc에서도 인증된 사용자 정보를 자동으로 PasswordForm 클래스에 바인딩 시켜 패스워드 수정(POST)이 되었으면 합니다. 하지만 기대한 것과 달리 email, nickname 파라미터를 직접 설정해주지 않으면 테스트가 실패하는 상황입니다. 패스워드 수정(POST)은 View에 있는 Form을 통해 입력된 값들이 요청을 통해 넘어오면서 처리되지만, 테스트 코드에서는 아무리 인증된 사용자를 만들어 준다고 하더라도 실제로 요청 Parameter에서는 email과 nickname값이 누락된체 넘어가기 때문에 실패하는게 당연한 것이다라고 생각이 들었습니다. 결국 이 테스트가 실패한 원인은 패스워드 수정 시 '현재 패스워드' 와 '현재 인증된 회원의 DB에 저장된 패스워드'를 검사하는 로직을 포함시켰기 때문에 인 것 같은데요. 이런 상황에서도 테스트 코드를 성공시킬 방법이 있는지 조언 부탁드리겠습니다. 미리 답변 감사합니다.
- 해결됨스프링과 JPA 기반 웹 애플리케이션 개발
패스워드 수정 시 '현재 패스워드'를 추가로 인증시키는 방법에 대한 질문입니다.
안녕하세요. '패스워드 수정' 강의와 해당 강의에 등록된 질문(https://www.inflearn.com/questions/302863)을 통해 회원의 패스워드 수정 시 '현재 패스워드'를 추가로 인증시키도록 코드를 변경하던 중 옳바른 개발 방법(?)에 대해 질문드립니다. 우선 패스워드 변경 View에서 '현재 패스워드'를 입력할 수 있도록 'input[type="password"]' 태그를 추가하고, PasswordForm(DTO 역할) 클래스에 'oldPassword'라는 프로퍼티를 추가했습니다. 이후 제가 하고자 하는 것은 패스워드 변경 유효성 검사를 하기 위해 생성했었던 PasswordFormValidator 클래스에서 View에서 입력받은 '현재 패스워드 값'과 'DB에 저장된 회원의 현재 패스워드 값'을 비교하여 일치하지 않는다면 Custom한 Error 메시지를 View로 전달해주고 싶은 상황입니다. 여기서 고민되는 것은 '패스워드 변경 Form' 요청 핸들러 메소드에서는 현재 인증된 회원 정보를 Model에 담아주고 있기 때문에 View쪽에 'input[type="hidden"]' 태그를 추가한 뒤 회원의 이메일, 닉네임 값을 설정하고 패스워드 변경 요청 시 PasswordForm 클래스에 그 값이 바인딩 될 수 있도록 아래와 같이 이메일, 닉네임 프로퍼티를 추가하여 PasswordFormValidator 클래스에서 DB에 저장된 회원의 현재 패스워드 값을 비교해서 틀린 경우 Error를 생성해 줄 것인가 아니면 이를 Validator가 아닌 '패스워드 변경 비즈니스 로직'에서 할 것인가입니다. 만약, 비즈니스 로직에서 현재 비밀번호에 대한 유효성 검증을 진행하는 경우 PasswordForm 클래스에 굳이 필요 없는 email, nickname 프로퍼티를 추가하지 않아도 되는데요. 이 두가지 방법 중 어떤 경우가 좀 더 효율적인지, 제가 생각하지 못한 방법이 또 있는지(비슷한 상황들에 대한 노하우) 조언 부탁드리겠습니다. 미리 답변 감사합니다. 아래는 PasswordFormValidator을 통해 현재 패스워드 유효성 검사를 진행할 경우에 대한 예시 코드입니다.
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
accountRepository.findById 사용시 리턴값이 없으니까..
안녕하세요 선생님 강의 너무 재미있게 잘듣고 있습니다! 질문은 다음과 같습니다. 회원가입 패스워드 인코딩 - 10:37 쯤에 제목처럼 findById 사용시 "return 해주는 값이 없으니까..." 이것이 무슨의미인가요? @GeneratedValue 라서 findById(1L) 하면 가져와지는것을테스트 해보았습니다. 선생님이 굳이 안쓰신 이유가 있으신것같아서 그 이유를 알고 싶습니다.
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
컨트롤러 관련 질문 드립니다.
@PostMapping("/settings/profile") ... return "redirect:/profile/" + account.getNickname(); 이러한 방식으로 프로필 창으로 바로 넘어가고 싶은데 닉네임이 한글일 경우 ???로 깨짐 현상이 일어납니다. 해결방법을 찾아봐도 해결되지 않아 질문드립니다ㅠ 어느 부분을 수정해야할지 알려주실 수 있을까요?
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
현재 mysql을 사용중입니다.
회원가입을 하면 token은 db로 들어옵니다. 강사님이 하신것처럼 콘솔에있는 토큰값을 복사해서 테스트를 해보았는데요. 제대로 반영이 된것 같은데 디비에는 email_verified, joined_at이 update가 안됩니다. 추가로 더 수행해야할 것들을 못찾겠는데 원인이 뭔지 알수있을까요??
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
andDo(print()) 에 관한 질문입니다.
안녕하세요 선생님 강의에 관해 질문이 있습니다. andDo(print())를 쓰시면서 말씀하신 내용이 다음과 같은데 "타임리프이기 때문에 view template rendering을 servlet container가 하지 않고..." 이러셨는데 타임리프의 자체 template engine이 view template rendering을 담당하기 때문이다. 라고 이해하면 맞을까요?
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
규정엔 맞지 않지만.. 환불가능할까요?
안녕하세요. 유튜브로 종종 취업썽과 QnA 답해주시는 영상을 보며 자주 동기부여를 받고 있어요. 다름이 아니라 환불을 부탁드린 이유는 기초지식이 부족해서였습니다. 미리보기에서 공지해주시기도 했지만, 중간중간 어떤 동작원리로 돌아가는지 감을 못잡겠더라구요 😣 규정상 프로젝트를 다운로드했고 8강의를 들었기에 환불이 어렵다는 건 잘 알고 있습니다만.. 다른 강의를 듣거나 환불이 가능할까요?
- 해결됨스프링과 JPA 기반 웹 애플리케이션 개발
지원중단
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. public class SecurityConfig extends WebSecurityConfigurerAdapter 에서 WebSecurityConfigurerAdapter 이게 지원중단이라떠서 더이상 진행이 불가능한데 어떻게 해결할 수 있나요?
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
스프링 부트 버전 궁금한것이 있습니다.
현재 강의에서는 2.2.4 버전으로 진행하고 있는것을 확인했습니다. 인텔리제이에서 프로젝트를 새로 생성하게 되면 스프링 부트 지원되는 아래와 같습니다. 2.7.0 버전으로 시작해보려고 하는데 문제는 없을까요 ?
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
안녕하세요 질문입니다.
안녕하세요. 강의가 저랑 잘 안 맞는거 같아서 보니까 대시보드 메인 수강평에 별로 안맞는거 같으면 환불 해주신다.적혀있어서 혹시나 환불 가능 여부 여쭤보고 싶습니다. 환불 기간이 지나서 직접 인프런 환불은 불가능 하더라구요.. 환불 가능한지 여쭤보고 싶습니다.
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
then(javaMailSender) 에서 import가 되지 않습니다.
11분 40초 쯤에서 then(javaMailSender).should().send(any(SimpleMailMessage.class)); 이 부분에서 then이 임포트가 되지 않습니다..org.mockito.core 를 따로 쳐서 임포트 해보려 했지만 뜨지 않습니다. 전체코드입니다. package com.wook.demo.account; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import org.mockito.configuration.*; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.BDDMockito.Then; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.test.web.servlet.MockMvc; @SpringBootTest @AutoConfigureMockMvc public class AccountControllerTest { @Autowired private MockMvc mockMvc; @Autowired private AccountRepository accountRepository; @MockBean private JavaMailSender javaMailSender; @DisplayName("회원 가입 화면 보이는지 테스트") @Test void signpForm() throws Exception { mockMvc.perform(get("/sign-up")) .andDo(print()) .andExpect(status().isOk()) .andExpect(view().name("account/sign-up")) .andExpect(model().attributeExists("signUpForm")); } @DisplayName("회원 가입 처리 - 입력값 오류") @Test void signUpSubmit_with_wrong_input() throws Exception { mockMvc.perform(post("/sign-up") .param("nickname", "shinwook") .param("email", "email...") .param("password", "12345") .with(csrf())) .andExpect(status().isOk()) .andExpect(view().name("account/sign-up")); } @DisplayName("회원 가입 처리 - 입력값 정상") @Test void signUpSubmit_with_correct_input() throws Exception { mockMvc.perform(post("/sign-up") .param("nickname", "shinwook") .param("email", "email@naver.com") .param("password", "12345678") .with(csrf())) .andExpect(status().is3xxRedirection()) .andExpect(view().name("redirect:/")); assertTrue(accountRepository.existsByEmail("email@naver.com")); then(javaMailSender).should().send(any(SimpleMailMessage.class)); } }
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
validation 한글
안녕하세요!우선 저는 커밋으로 불러오지 않고 깃허브에서 sign-up.html을 가져왔습니다.그런데 9분쯤에 닉네님을 입력하셨을 때validation 오류가 영어로 나오시는데저는 왜 한글로 나오는지 잘 모르겠습니다.sign-up.html을 봐도 그런 부분은 없는것 같은데 ㅜㅜ
- 미해결스프링과 JPA 기반 웹 애플리케이션 개발
활동지역 클릭시 에러
소스 모 두 일치 시키고 실행해보면 아래와같은 에러메시지가 나오면서 정상적으로 뜨지를 않습니다. 도움을 요청드립니다. 스터디주제도 동일하게 나옵니다. Cannot render error page for request [/study/%EB%B4%84%EC%8B%B9%EC%8B%B9/settings/zones] and exception [An error happened during template parsing (template: "class path resource [templates/study/settings/zones.html]")] as the response has already been committed. As a result, the response may have the wrong status code.
- 해결됨스프링과 JPA 기반 웹 애플리케이션 개발
(응용) 프로젝트 진행 전 상수-Constants 구성 에 관한 질문입니다.
자주 쓰이고, 오타가 날법한 String 을 모아 아래 처럼 상수화 했습니다. 상수패키지 com.studyolle.core.constant.* 이후 Controller , Test 등에서 아래와 같이 사용중입니다. 질문입니다 Enum 으로 관리 하려고 했지만, 컨트롤러-핸들러 의 @GetMapping( Enum.URI.name() ) 과같은 선언도 불가능 하고, 단순 값 참조를 Enum .name() 이라던지, Enum .custom() 과 같이 덕지덕지 메서드가 붙게되어, 심플하게 하고자, Enum 은 사용하지 않았습니다. 그러나 이렇게 static final 필드로 관리하다보면, 언젠가 양이 많아 질탠데, 이럴 경우는 또다시 나누어야 될거라 생각이 듭니다만.. 이런 일반적인 방식 보다 효과적으로 관리하는 ( Map 을 쓴다던지, 특정 패턴이라던지) 방법이 있을까요? 상수 관리는 이런 방향이 괜찮았다.. 라는 사례가 궁금합니다. 읽어주셔서 감사합니다.