Posts
Q&A
/actuator/refresh ๊ฐ ๋์ํ์ง ์์ต๋๋ค.
์ธํ ๋ฆฌ์ ์ด๋ ์์ ๋๋ก ๊ฐ๋ฅํ์ง๋ง..config-server๋ฅผ ์ฌ์คํ ํ๋ฒ ํด์ผํ๋ค์;;์ฝํ๋ฆฐ์ผ๋ก๋ ์๋ฒ ๊ธฐ์ค์ผ๊ฒฝ์ฐ.. config-server๋ ์ด๋ป๊ฒํด์ผํ๋์?
- 2
- 3
- 612
Q&A
java.lang.AssertionError: Status
ํด๊ฒฐํ์ต๋๋ค / ์ด ์์ต๋๋ค.์ด์ ์ด์๊ฐ์ ์์์ํด์ ์ ์ ์์ง ๋ชปํ์ต๋๋ค.์ง ๊ทผ์ฒ ํ์ฑ ๋ฐฉ์๊ฐ์ maven ๊ด๋ จ๋ ๋์ ์์ผ๋ฉด ๋ด์ผ๊ฒ ๋ค๋์๊ฐ์ด๋ค์๊ณ ..Test์ฝ๋์ ๋ํด ๋ค์ํ๋ฒ ์๊ฐํด๋ณด๊ฒ๋์์ต๋๋ค.๊ฐ์ฌํฉ๋๋ค.uri๊ฒฝ๋ก์ ' / ' ์๋ ์๋ ์ ์ฐจ์ด์ ๋ํด ๊ณต๋ถํ๊ฒ ๋์์ต๋๋ค.๊ธฐ์ ๋ ๊ฐ์ ์ค๋์ ์ ๊ตฌ๋งคํ๊ณ ๊ณต๋ถํด์ผ์ง ํ๊ณ ๋ฏธ๋ฃจ๊ณ ์์๋๋ฐ์ง๊ธ๊น์ง ์ฝ๋ฉํ๋ ์ฝ๋๋ค์ ๋ณด๋ฉด์ 3.x๋ฒ์ ๋ ์๋ก ๋ง๋๋๋ฐ๋ฐ์ฑํ๋ ๊ณ๊ธฐ๊ฐ ๋์์ต๋๋ค.์์ง๋ด์๋์ง ๊ฑด๊ฐํ์๋์ง ๋ชจ๋ฅด์ง๋ง..๋ง์๊ฒ ๋ฐฐ์ฐ๊ณ ์ถ์ต๋๋ค.
- 0
- 2
- 447
Q&A
java.lang.AssertionError: Status
>package com.example.wrpi.global.events;import com.example.wrpi.domain.entity.Event;import com.example.wrpi.domain.repository.EventRepository;import com.fasterxml.jackson.databind.ObjectMapper;import org.junit.Test;import org.junit.runner.RunWith;import org.mockito.Mockito;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;import org.springframework.boot.test.mock.mockito.MockBean;import org.springframework.hateoas.MediaTypes;import org.springframework.http.MediaType;import org.springframework.test.context.junit4.SpringRunner;import org.springframework.test.web.servlet.MockMvc;import java.time.LocalDateTime;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.*;import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;@RunWith(SpringRunner.class)@WebMvcTestpublic class EventControllerTest {@Autowired MockMvc mockMvc; @Autowired ObjectMapper objectMapper; @MockBean EventRepository eventRepository; @Test public void createEvent()throws Exception{Event event = Event.builder().name("Spring").description("REST API Development with Spring").beginEnrollmentDateTime(LocalDateTime.of(2018, 11, 23, 14, 21)).closeEnrollmentDateTime(LocalDateTime.of(2018, 11, 24, 14, 21)).beginEventDateTime(LocalDateTime.of(2018, 11, 25, 14, 21)).endEventDateTime(LocalDateTime.of(2018, 11, 26, 14, 21)).basePrice(100).maxPrice(200).limitOfEnrollment(100).location("๊ฐ๋จ์ญ D2 ์คํํ ํฉํ ๋ฆฌ").build(); event.setId(10); Mockito.when(eventRepository.save(event)).thenReturn(event); mockMvc.perform(post("/api/events/").contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaTypes.HAL_JSON).content(objectMapper.writeValueAsString(event))).andDo(print()).andExpect(status().isCreated()).andExpect(jsonPath("id").exists()); }}>package com.example.wrpi.domain.controller;import com.example.wrpi.domain.entity.Event;import com.example.wrpi.domain.repository.EventRepository;import org.springframework.hateoas.MediaTypes;import org.springframework.http.MediaType;import org.springframework.http.ResponseEntity;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import java.net.URI;import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;@Controller@RequestMapping(value="/api/events",produces = MediaTypes.HAL_JSON_VALUE)public class EventController {private final EventRepository eventRepository; public EventController(EventRepository eventRepository){this.eventRepository = eventRepository; }@PostMapping("/api/events")public ResponseEntity createEvent(@RequestBody Event event){Event newEvent = this.eventRepository.save(event); URI createdUri = linkTo(EventController.class).slash(newEvent.getId()).toUri(); return ResponseEntity.created(createdUri).body(event); }}>xml version="1.0" encoding="UTF-8"?>xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot spring-boot-starter-parent 3.3.2 com.example wrpi 0.0.1-SNAPSHOT jar white_rpi white_rpi > ct.build.sourceEncoding>UTF-8 UTF-8 19 org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-hateoas org.springframework.boot spring-boot-starter-web org.postgresql postgresql org.projectlombok lombok true org.modelmapper modelmapper 2.3.1 /dependency>-->org.springframework.security.oauth.boot-->spring-security-oauth2-autoconfigure-->2.1.0.RELEASE-->--> org.springframework.boot spring-boot-configuration-processor true com.h2database h2 2.3.230test--> pl.pragmatists JUnitParamsId> 1.1.1> test -->org.springframework.security-->spring-security-test-->${spring-security.version}-->test-->--> org.springframework.restdocs spring-restdocs-mockmvc 3.0.1-->test--> org.springframework.restdocs spring-restdocs-asciidoctor 3.0.1--> org.springframework.boot spring-boot-maven-plugin org.asciidoctor asciidoctor-maven-plugin 2.2.1 generate-docs prepare-package process-asciidoc html book maven-resources-plugin 3.3.1 > > copy-resources prepare-package copy-resources ${project.build.outputDirectory}/static/docs ${project.build.directory}/generated-docs org.apache.maven.plugins maven-surefire-plugin 3.2.1 -Xshare:off all org.apache.maven.plugins maven-failsafe-plugin 3.2.1 -Xshare:off integration-test verify org.apache.maven.plugins maven-compiler-plugin 3.11.0 19 19
- 0
- 2
- 447
Q&A
์ง๋ฌธ์์ต๋๋ค.
์ ๊ฐ์ฌํฉ๋๋ค..์ง๊ธ 3.1 ์ด์ ๋ฒ์ ์์?์ฌ์ด๋ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค๊ณ ์๋๋ฐ..์๊ฐ ์ฌ์ ๊ฐ ์์ด์ ์ค๋์ ์ ๊ธฐ์ ๋ ๊ฐ์ ๊ตฌ๋งคํด์ ํ์ตํ๊ณ ์์ต๋๋ค.3.X๋ฒ์ ์ ๋ง์ถฐ์ ์์ ๋ค์ ์คํํ๊ณ ์ถ์๋ฐ..security๊ณต๋ถํ๋ฉด์ ์ผ๋ถ ์ ๊ณตํ๋๊ธฐ๋ฅ์ด ์ ๊ณตํ์ง ์๋๊ฒ์ ์๊ฒ๋์ด์ ์ง๋ฌธ๋๋ ธ์ต๋๋ค.๋ฐ์์ ๋ฐ ๊ฐ์ฌํฉ๋๋ค.๊ธฐ์ ๋์ด ๋ฐ์์๊ฐ ์ชผ๊ฐ์๋ฉด์ ๋๋ฆ ๊ฐ์๋ฅผ ํ์ ๊ฒ์ผ๋ก ์๊ณ ์์ต๋๋ค.๊ฐ์ธ ์ฑ๋์ ์ ๋ฐ์ดํธ๊ฐ ์์ํ์๋๊ฒ ๊ฐ์์..์ฌ๊ธฐ์ ํ๋ฒ ์ง๋ฌธ์ ๋จ๊ฒจ๋ดค์ต๋๋ค.์๋์ ๋ถ์ ์ ์ธ ๊ธ ๋จ๊ธฐ์ ๊ธ ๋ณด๊ณ ํน์ ๋์ด์ ์ํ์๋ ๊ถ๊ธํด์ ์ง๋ฌธ๋๋ ค๋ดค์ต๋๋ค ^^
- 0
- 3
- 294
Q&A
๊ถ๊ธํ๊ฒ์์ด์ ์ง๋ฌธ๋๋ฆฝ๋๋ค.
๋จ๊ฒจ์ฃผ์ ๊ฒ ์ด์ ์ ๋ณด๊ฒ๋์์ต๋๋ค ^^ ๊ฐ์ฌํฉ๋๋ค.
- 0
- 2
- 437
Q&A
web jars๋ฅผ ๋ณด๊ณ ๋๋ผ๋๊ฑด๋ฐ์..
์ด์ฌํ ์ ์๋ ๊ฐ์ฌํฉ๋๋ค.
- 0
- 6
- 327
Q&A
web jars๋ฅผ ๋ณด๊ณ ๋๋ผ๋๊ฑด๋ฐ์..
์ ๊ฐ ๋ง๋ js๋ css๋ฅผ ๊ธฐ์ ํ๊ณ ์ถ์๋ฐ๋ฐ์ค์ ํ๋๋ฐฉ๋ฒ์ด ๊ถ๊ธํฉ๋๋ค.
- 0
- 6
- 327
Q&A
web jars๋ฅผ ๋ณด๊ณ ๋๋ผ๋๊ฑด๋ฐ์..
์ ๋ชจ๋ฅด๊ฒ ์ด์ ใ ๋ณด๊ธด ๋ดค๋๋ฐ ์ ๋ฐฉ๋ฒ์ด ์๋๊ฐ์? ์ ๊ฐ ์์ฑํ ๋งฅ๋ถ ํด๋์๋ ๋ฆฝ ํด๋๊ฐ ์กด์ฌํ์ง ์์์..
- 0
- 6
- 327