질문있습니다..!
598
작성한 질문수 4
강의 잘 보고있습니다,본문으로 들어가자면 똑같이 입력을하고 마지막이 테스트를 돌리면 JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default~ 이러한 경고메세지가 나오는데 뭐가문제일까요..?;
답변 4
1
제 기억으로는 스프링 부트 버전을 올리면서 JPA의 OSIV 기본 설정 값을 false로 바꾸자는 논의가 있었습니다. 그런데 그러면 하위 버전 호환성이 깨지면서 많은 문제를 야기할 거라서, 경고 메시지를 출력하는 걸로 이슈를 정리했습니다. 아마도 그것 떄문에 보여주는 경고성 메시지일 뿐이니 애플리케이션 자체가 문제는 없을겁니다. 다만 OSIV에 대해 공부를 하고 쓰신다면 더 좋겠죠.
0
답변감사합니다 경고메세지는 이러하고
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
코드는 이렇습니다
@Entity
public class Person {
@Id @GeneratedValue
private Long id;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
public interface PersonRepository extends JpaRepository<Person,Long> {
}
@RestController
public class SampleController {
@GetMapping("/hello")
public String Hello(@RequestParam("id") Person person){
return "hello " + person.getName();
}
}
@Configuration
public class WebConfig implements WebMvcConfigurer {
}
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class SampleControllerTest {
@Autowired
MockMvc mockMvc;
@Autowired
PersonRepository personRepository;
@Test
public void hello() throws Exception{
Person person=new Person();
person.setName("keesun");
Person savedPerson=personRepository.save(person);
this.mockMvc.perform(get("/hello")
.param("id",savedPerson.getId().toString()))
.andDo(print())
.andExpect(content().string("hello keesun"));
}
}
0
작성하신 코드랑 경고문을 복사해서 본문에 넣어주셨으면 좋았을거 같네요. 경고 자체는 별로 걱정이 안되는데 왜 저런 경고 메시지가 출력되는지는 코드를 봐야 알 수 있을거 같습니다.
7:58 예제 코드 찾는 법
0
255
2
PATCH의 Idempotent에 대한 질문
0
257
1
2:51초 질문입니다.
0
324
1
만약 어플리케이션컨텍스트에 필터를 설정하지 않으면 어떻게되나요?
0
361
0
web.xml에 위치한 애플리케이션 web.xml 내에서 파싱 오류 발생
0
513
0
Spring Boot 2.6 이상 버전에서의 DispatcherServlet
0
366
1
Event`Xxx`Controller 분리할때의 기준에 관한 질문입니다.
0
633
1
11분 57초 쯤, `returnValueHandlers` 들의 네이밍컨벤션 관련 질문입니다.
0
378
1
@EnableWebmvc 설정을 하면
0
414
1
springframework와의 차이점
0
282
1
@RequestBody의 바인딩에러를 잡는 방법
1
1654
2
안녕하세요 기선님 강의를 보다 서블릿에 궁금증이 생겨 질문 드립니다
1
236
1
HelloService의 값을 전달을 못 받습니다.
0
293
1
ServletContext와 WebApplicationContext의 관계 질문
1
740
1
하나의 서비스에, 두개의 리포지토리도 연결이 되나요?
0
362
1
view name 리턴에 대해
0
288
2
Formatter print 질문 드립니다.
0
232
1
에리 메시지가 한글입니다.
0
292
1
java 클래스파일로 설정되어 있던 것을 web.xml로 바꾸는 경우
0
336
1
@RequestParam
0
255
1
@Retention 질문
0
226
1
Event.builder() 관련 mac에서 lombok 문제 있으신 분들
0
195
1
스프링 부트 사용시 WebMvcConfigurerSupport 클래스
0
250
1
http://localhost:8080/hello 입력시 오류
0
486
4





