Java(129)
-
Spring boot Security DB 연동
DB 연동 객체@Datapublic class Member { private String id; private String name; private String passwd;}@Servicepublic class MemberService { MemberMapper memberMapper; public MemberService(MemberMapper memberMapper) { this.memberMapper = memberMapper; } public List getMemberList() { return memberMapper.getMemberList(); } public Member getMember(String id) { return memberMapper.getMember(id); } p..
2024.06.09 -
Sprng boot Security 적용
pom.xml# dependabct 추가 # thymeleaf 추가 org.springframework.boot spring-boot-starter-thymeleaf # spring security 추가 org.springframework.boot spring-boot-starter-security # spring boot 3.2.5에 포함되어 있음 org.thymeleaf.extras thymeleaf-extras-springsecurity6 3.1.1.RELEASE org.springframework.security spring-security-test test환경설정 추가@Configuration..
2024.05.26 -
@Controller와 @RestController를 같이 사용하기
@Controller와 @RestController를 같이 사용하면, @Controller가 작동하지 않음 @Controller 사용# Main.java@Controllerpublic class Main { @RequestMapping("/a") public String deGetHelloWorld() { System.out.println("ssssssssssssssssssssssssss"); return "Hello World"; } @GetMapping("/") public String home() { return "home"; }}# /src/main/resources/templates/home.html Welcome! Click here to see ..
2024.05.26 -
Spring boot 3.2.5 and JDK17 셋팅
서비스 Prot 설정# application.propertiesserver.port=8080로깅설정# application.propertieslogging.level.root=infologging.level.{원하는 패키지}=debugFilter 설정JDK17에서는 jakarta.servlet.Filter를 사용해야 됨chain.doFilter(request, response)가 빠지면 안됨urlPatterns를 "/*"로 설정해야 함# 필터 생성@Slf4jpublic class AuthFilter implements Filter {@Override public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletRes..
2024.05.19 -
Spring Authorization Server 테스트
https://traeper.tistory.com/223 OAuth 2.0 - Spring Authorization Server 프랙티스 Spring Authorization Server Practice Spring Authorization Server 프레임워크는 OAuth 2.0 중 Authorization Server 부분을 쉽게 구현할 수 있게 해준다. 우선 OAuth 2.0에 대해 간략히 살펴보자. OAuth 2.0 rfc6749 문서에 따르면 traeper.tistory.com
2024.03.14 -
Spring boot 3.2.3 설정
프로젝트 생성 New > Other.. > Spring Boot > Spring Starter Project Type: Maven Packaging: Jar Java Version: 17 실행 Window > Show View > Other.. Other > Boot Dashboard Boot Dashboard에서 해당 프로젝트 선택 > (Re)start Trouble Shooting Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springframework/boot/SpringApplication has been compiled by a more recent version of the Java Runtime (class f..
2024.03.14