728x90 728x90 Spring20 [Spring; 스프링] Swagger 설정 Spring Boot 프로젝트에서 Swagger를 설정하는 방법은 다음과 같습니다. 1. Maven 또는 Gradle 의존성 추가 Maven: io.springfox springfox-boot-starter 3.0.0 Gradle: implementation 'io.springfox:springfox-boot-starter:3.0.0' // 현재 사용 가능한 최신 버전으로 업데이트하세요 2. Swagger 설정 클래스 생성 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInf.. 2023. 10. 24. [Spring; 스프링] Scheduler Cron ( 크론 / 스케줄러 ) SpringBoot Scheduler Cron 스프링 스케줄 설정 @EnableScheduling @SpringBootApplication public class Application { @Scheduled(cron = "10 * * * * *") public void run() { // 10초마다 실행 System.out.println("안녕하세요! " + LocalDateTime.now().toString()); } } @EnableScheduling 어노테이션을 설정합니다. 그리고 시간을 지정할 메소드 위에 @Scheduled(cron = "10 * * * * *") 시간을 지정해줍니다. 크론의 표현식은 여섯자리로 이루어져있습니다. # ┌───────────── second (0-59) # │ ┌─.. 2023. 10. 20. [Spring; 스프링] RequestRejectedException - Spring Security 아침마다 에러로그를 확인하는데 처음 보는 에러 로그가 있었다. 2023-10-17 18:18:17 ERROR [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String "//" at org.. 2023. 10. 18. [Spring; 스프링] Spring Security Spring Security는 Spring 기반의 Java 웹 응용 프로그램에서 보안과 인증을 관리하는 데 사용되는 강력한 보안 프레임워크입니다. Spring Security는 사용자 인증, 권한 부여, 보안 설정, 세션 관리 등과 관련된 기능을 제공하여 웹 응용 프로그램의 보안을 강화합니다. Spring Security의 주요 기능은 다음과 같습니다. 사용자 인증 (Authentication): 사용자가 누구인지 확인하고 사용자의 자격 증명을 검증합니다. 권한 부여 (Authorization): 인증된 사용자가 어떤 리소스나 기능에 접근할 수 있는지 결정합니다. 보안 설정 (Security Configurations): 보안 규칙을 정의하고 설정하여 어떤 URL에 어떤 보안 수준을 적용할지 결정합니다... 2023. 10. 5. [Spring; 스프링] mappedBy 연관관계 mappedBy는 JPA에서 양방향 연관관계를 설정할 때 사용하는 속성입니다. mappedBy는 연관관계의 주인이 아닌 쪽에서 지정해야 하며, 연관관계의 주인을 가리키는 필드명을 값으로 줍니다. 예를들어, User엔티티와 CellularPhone 엔티티가 일대일 양방향 연관관계를 가지고 있고, User 엔티티가 연관관계의 주인이라면, CellularPhone 엔티티에서는 @OneToOne(mappedBy = "cellularPhone) 와 같이 어노테이션을 적용해야 합니다. 이렇게 하면 CellularPhone 엔티티는 User 엔티티의 cellularPhone 필드에 의해 매핑된다는 것을 나타냅니다. mappedyBy를 사용하는 이유는 양방향 연관관계에서 두 엔티티 모두가 관계를 관리하면 무한 루프에 .. 2023. 10. 4. [Spring; 스프링] SpringBoot JPA Entity 오늘은 SpringBoot JPA Entity에 대해 설명해드리겠습니다. 😊😊 SpringBoot JPA Entity란 스프링 부트에서 JPA를 사용하기 위해 정의하는 클래스입니다. JPA는 Java Persistence API의 약자로, 자바에서 관계형 데이터베이스와 객체를 매핑하는 기술입니다. @Entity 어노테이션을 사용하면 해당 클래스가 JPA 엔티티임을 선언할 수 있습니다. 엔티티는 데이터베이스의 테이블과 일대일로 대응하며, 각 엔티티 인스턴스는 테이블의 행을 나타냅니다. @Entity 어노테이션은 클래스 레벨에 적용하며, 엔티티의 이름은 기본적으로 클래스의 이름과 같습니다. name 속성을 사용하면 엔티티의 이름을 변경할 수 있습니다. 예를 들어, @Entity (name="student").. 2023. 10. 4. 이전 1 2 3 4 다음 728x90 728x90