일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- git
- 서브셋폰트
- package
- 디자인 패턴
- 객체지향
- DP
- github
- npm
- MariaDB
- 추상화
- 캡슐화
- 메모이제이션
- Java
- netlify
- PostgreSQL
- 다형성
- process.env
- 상속
- dfs
- bfs
- dotenv
- AOP
- 클라우드
- GOF
- Secret
- 동적계획법
- CSS
- azure
- Solid
- mock
Archives
- Today
- Total
이것저것 해보기🌼
springSecurityFilterChain cannot be null 에러 해결방법 본문
에러 로그
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
java.lang.IllegalStateException: springSecurityFilterChain cannot be null. Ensure a Bean with the name springSecurityFilterChain implementing Filter is present or inject the Filter to be used.
at org.springframework.util.Assert.state(Assert.java:97)
at org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurer.beforeMockMvcCreated(SecurityMockMvcConfigurer.java:76)
at org.springframework.test.web.servlet.setup.AbstractMockMvcBuilder.build(AbstractMockMvcBuilder.java:176)
at com.figstudy.web.BooksApiControllerTest.setup(BooksApiControllerTest.java:52)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
에러 위치
@BeforeEach
public void setup() {
mvc = MockMvcBuilders
.webAppContextSetup(context)
.apply(springSecurity())
.build();
}
위 코드에서 build() 를 할때 springSecurityChain이 null이라서 에러가 발생한다.
참고 : https://sbs1621.tistory.com/54
[Spring] MockMvc를 이용한 Controller의 Test Code(JUnit5) 작성하기
간단하게 작성할 수 있는 게시판 Controller에 대한 테스트코드입니다. 테스트코드 추가하기 컨트롤러에서 cmd + shift + t(윈도우는 control + shift + t)를 누르시면 간단하게 테스트코드를 만들 수 있습
sbs1621.tistory.com
https://docs.spring.io/spring-security/site/docs/5.0.x/reference/html/test-mockmvc.html
12. Spring MVC Test Integration
There are a number of options available to associate a user to the current HttpServletRequest. For example, the following will run as a user (which does not need to exist) with the username "user", the password "password", and the role "ROLE_USER": You can
docs.spring.io
'BE > Spring Boot' 카테고리의 다른 글
application.yml 파일을 local, dev, prod, oauth 등으로 세분화하기 (0) | 2024.05.07 |
---|---|
Spring Security Deprecated 코드 변환하기 (0) | 2024.05.07 |
java.lang.ClassNotFoundException: org.h2.Driver - H2 연결 에러 해결 (0) | 2024.05.07 |
[웹] 세션 (0) | 2021.08.29 |
[프로그래머스 과제관] 주문 관리 API 서버 개발 (6) | 2021.07.08 |