Posts
Q&A
์ค์ต์ ์ํ ๊ตฌ๊ธ ๋๋ผ์ด๋ธ ์ ๊ทผ๊ถํ ํด์ ์์ฒญ
๊ถํ ํ์ด์ฃผ์ธ์ ์ผ์ผํ ์ด๋ ๊ฒ ์์ฒญํด์ผ ํ๋์
- 0
- 2
- 22
Q&A
http://localhost:8080/request-param-v1
log.info("username={},age={}",username,age );๋ต๋ณ๊ฐ์ฌ๋๋ฆฝ๋๋คsetting์์ idea ๋ gradle ์ด๋ jdk 11๋ก ๋ฐ๊ฟ์คซ๋๋ฐ๋ ์ 15๋ก ๋จ๋๊ฑธ๊น์?
- 0
- 5
- 374
Q&A
http://localhost:8080/request-param-v1
@Slf4j@Controllerpublic class RequestParamController { @RequestMapping("/request-param-v1") public void requestParamV1(HttpServletRequest request, HttpServletResponse response) throws IOException { String username = request.getParameter("username"); int age = Integer.parseInt(request.getParameter("age")); response.getWriter().write("ok"); } @ResponseBody @RequestMapping("/request-param-v2") public String requestParamV2( @RequestParam("username") String memberName, @RequestParam("age") int memberAge) { log.info("username={}, age={}", memberName, memberAge); return "ok";//@RestController ๊ฐ์ํจ๊ณผ } } #์ ์ฒด ๋ก๊ทธ ๋ ๋ฒจ ์ค์ (๊ธฐ๋ณธ info)logging.level.root=info#hello.springmvc ํจํค์ง์ ๊ทธ ํ์ ๋ก๊ทธ ๋ ๋ฒจ ์ค์ logging.level.hello.springmvc=debug2021-04-24 21:05:34.313 INFO 15380 --- [ main] hello.springmvc.SpringmvcApplication : Starting SpringmvcApplication using Java 15.0.2 on DESKTOP-C6Q38EP with PID 15380 (C:\study\springmvc\springmvc\out\production\classes started by 82109 in C:\study\springmvc\springmvc) 2021-04-24 21:05:34.317 DEBUG 15380 --- [ main] hello.springmvc.SpringmvcApplication : Running with Spring Boot v2.4.5, Spring v5.3.6 2021-04-24 21:05:34.318 INFO 15380 --- [ main] hello.springmvc.SpringmvcApplication : No active profile set, falling back to default profiles: default 2021-04-24 21:05:35.409 INFO 15380 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2021-04-24 21:05:35.421 INFO 15380 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2021-04-24 21:05:35.421 INFO 15380 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.45] 2021-04-24 21:05:35.515 INFO 15380 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2021-04-24 21:05:35.515 INFO 15380 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1132 ms 2021-04-24 21:05:35.915 INFO 15380 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2021-04-24 21:05:36.292 INFO 15380 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html] 2021-04-24 21:05:36.465 WARN 15380 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration) 2021-04-24 21:05:36.551 INFO 15380 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-04-24 21:05:36.563 INFO 15380 --- [ main] hello.springmvc.SpringmvcApplication : Started SpringmvcApplication in 2.734 seconds (JVM running for 3.135)2021-04-24 21:06:19.710 INFO 15380 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2021-04-24 21:06:19.710 INFO 15380 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2021-04-24 21:06:19.712 INFO 15380 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
- 0
- 5
- 374
Q&A
http://localhost:8080/request-param-v1
๋ค ๋๊ฐ์ด ok๋ง ๋น๋๋ค
- 0
- 5
- 374
Q&A
servletApplication.main()๋ฉ์๋๊ฐ ๊ฒ์ ์คํ๋๋๋ฐ ๋๋์ง ์์์?
๋ช ํํ ์ค๋ช ๊ฐ์ฌ๋๋ฆฌ๊ณ ํ๊ธ์ ๋ค๋ฅธ๋ฐฉ๋ฒ์ผ๋ก ํด๊ฒฐํ์ด์!!
- 0
- 3
- 2.3K
Q&A
Assertions. ์์ ์ํฌํธ๋ฅผ ๋ฐ์ง ๋ชปํฉ๋๋ค import org.assertj.core.api.Assertions; ๋ฐ์ง๋ชปํ๋ ๊ธฐ๋ฅ์ํ์ด ์๋๋ค์ bulid.gradle์ ์ถ๊ฐํด์ผ ํ ๊บผ๊ฐ์๋ฐ์
plugins { id 'org.springframework.boot' version '2.4.3' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java'}group = 'hello'version = '0.0.1-SNAPSHOT'sourceCompatibility = '11'repositories { mavenCentral()}dependencies { implementation 'org.springframework.boot:spring-boot-starter' implementation 'junit:junit:4.12' implementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation ('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' }}test { useJUnitPlatform()}์ด๋ค๊ฑฐ๋ฅผ ์ถ๊ฐํด์ผ ๋์ง์??
- 1
- 4
- 1.9K
Q&A
Assertions. ์์ ์ํฌํธ๋ฅผ ๋ฐ์ง ๋ชปํฉ๋๋ค import org.assertj.core.api.Assertions; ๋ฐ์ง๋ชปํ๋ ๊ธฐ๋ฅ์ํ์ด ์๋๋ค์ bulid.gradle์ ์ถ๊ฐํด์ผ ํ ๊บผ๊ฐ์๋ฐ์
// https://mvnrepository.com/artifact/org.assertj/assertj-coretestImplementation group: 'org.assertj', name: 'assertj-core', version: '3.19.0'์ด๊ฑธํด๋ ์์ฉ์๋ค์
- 1
- 4
- 1.9K
Q&A
์ปค์คํ ํ๊ทธ ํ์ผ ์ฌ๋ฆฐ์ฃผ์์์
์ธ์ ๋ต๋ณ์ฃผ์๋์
- 0
- 2
- 299
Q&A
jstl์ ์ฝ์ด๋ค์ด์ง ๋ชปํ๋๋ฐ์
์๋๋๋ฐ์..
- 0
- 2
- 484