백엔드/spring
-
spring boot 3.0.2: security 구현백엔드/spring 2023. 2. 18. 14:37
#spring boot 3.0.2 , java 17 버전으로 웹페이지를 구현한 글입니다. A. SecurityFilterChain @Configuration public class SecurityConfiguration { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{ return http. authorizeHttpRequests(authorize -> authorize .requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll() .requestMatchers( HttpMethod.GET, "/", "/articles",..
-
Spring boot : Error executing DDL "create index 에러 해결백엔드/spring 2023. 2. 16. 19:24
쿼리를 날려 db에 data를 넣으려 했으나.. 위와 같은 에러가 발생했고, 나는 늘 그랬듯이 구글링으로 찾아봤다. 처음에는 데이터베이스 예약어를 column 명으로 넣어서 발생하는 에러(https://csy7792.tistory.com/66)인가 싶었지만, 예약어를 사용하지 않았기 때문에 다른 곳에서 문제가 발생한 것 같았다. https://stackoverflow.com/questions/43191294/hibernate-error-executing-ddl-via-jdbc-statementhttps://github.com/jojoldu/freelec-springboot2-webservice/issues/67. 를 참고한 결과, application.yml 에 설정한 dialect 관련 문제일 수 있겠..
-
spring boot : table doesn't exist 에러백엔드/spring 2023. 2. 16. 17:50
data.sql 파일을 intellij datagrip 을 통해 넣으려 했으나, table 이 존재하지 않는다는 에러만 돌아올 뿐이었다. 분명이, ddl-auto 도 create 로 설정했는데, 되지 않아 이것저것 3시간 가량 찾아봤지만 되지 않았다. jpa: hibernate: ddl-auto: update database-platform: org.hibernate.dialect.MySQL5Dialect update 로 바꿔도 보고 https://twoicefish-secu.tistory.com/405 을 참고해 여러 가지를 넣어봤다. 그런데, 생각해보니 service, application 자체를 작동시키지 않은 채 query를 실행하고 있었던 것이다. application 을 실행하자 마자 잘 작동..
-
spring boot - thymeleaf layout dialect 적용백엔드/spring 2023. 2. 16. 13:14
https://wildeveloperetrain.tistory.com/136 Spring Boot 타임리프 Thymeleaf layout 적용하는 방법 타임리프(Thymeleaf)에 대해서 간단하게, 타임리프는 서버 사이드 템플릿 엔진(Template Engine)의 한 종류로, 쉽게 컨트롤러가 전달하는 데이터를 이용하여 동적으로 화면을 구성할 수 있게 해주는 역 wildeveloperetrain.tistory.com https://blog.outsider.ne.kr/1004 Thymeleaf에서 레이아웃 기능을 지원하는 Thymeleaf Layout Dialect :: Outsider's Dev Story 전에 [Thymeleaf에 대한 얘기를 올렸었지만](http://blog.outsider.ne.k..
-
spring boot template 파일 내 html 파일 인식 에러 문제백엔드/spring 2023. 2. 14. 19:14
한창 신나게 웹페이지를 만들던 중, 기본적인 templates 파일 내 html 파일을 인식하지 못하고 404 에러가 발생했다. 그래서, https://bottom-to-top.tistory.com/38 Spring Boot HTML 파일 templates에서도 읽도록 설정하기 static 아닌 폴더에서 정적 정보 읽어오기 스프링 부트에 web 의존성을 추가하고 localhost:8080으로 접근하면 기본적으로 resources 폴더에 있는 static 에 위치한 index.html 파일을 읽게됩니다. 프로젝트를 bottom-to-top.tistory.com 을 참고하여 addResourceHandler 를 오버라이딩 해 추가했지만 해결되지 않았다. 그런데, 문득 이런 생각이 들었다. static 파일과..
-
CRUD Repository 와 Optional 그리고 dto백엔드/spring 2023. 2. 13. 18:48
앞서 웹페이지 만들기 강의를 따라간 것을 토대로 스스로 웹페이지 만들기를 하던 중, 다음과 같은 상황이 발생했다. findById 가 articleId를 토대로 Article 을 반환하는 줄 알았는데 아니네? 그렇다. CRUD repository interface method인 findById 는 Optional 을 반환한다. 그렇다면, Optional이 과연 무엇인가? 참고:https://mangkyu.tistory.com/70 [Java] Optional이란? Optional 개념 및 사용법 - (1/2) 이번에는 Java8부터 지원하는 Optional 클래스에 대해 알아보도록 하겠습니다. 1. Optional이란? Optional 개념 및 사용법 [ NPE(NullPointerException) 이..
-
spring boot @RepositoryRestResource, @RepositoryResourceController 디펜던시 추가백엔드/spring 2023. 2. 13. 16:06
https://docs.spring.io/spring-data/rest/docs/current/reference/html/#repository-resources Spring Data REST Reference Guide Spring Data REST presents a default view of the domain model you export. However, sometimes, you may need to alter the view of that model for various reasons. This section covers how to define projections and excerpts to serve up simplified and reduced vie docs.spring.io 를 참..
-
웹페이지 만들기1 :환경 설정백엔드/spring 2023. 2. 10. 12:29
spring boot 3.0 부터는 java 17기반으로 변경된다. java 17을 선택한 이유? 다음 세대 플래폼 호환성 나는 해당 웹페이지를 오랜 기간동안 운영할 수 있다고 보기 때문에, 다음 세대와의 호환성 역시 중요했다. 참고:https://techblog.gccompany.co.kr/%EC%9A%B0%EB%A6%AC%ED%8C%80%EC%9D%B4-jdk-17%EC%9D%84-%EB%8F%84%EC%9E%85%ED%95%9C-%EC%9D%B4%EC%9C%A0-ced2b754cd7 dependencies 일단 필수적인 것들만 추가해놓고 추후 필요한 것은 그때 그때 추가하기로 했다.