본문 바로가기
반응형
반응형

springBoot8

반응형
[Spring Boot] Spring Security + JWT token 로그인 @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() //h2 .headers() .frameOptions() .sameOrigin() // 시큐리티는 기본적으로 세션을 사용 // 여기서는 세션을 사용하지 않기 때문에 세션 설정을 Stateless 로 설정 .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() //권한 .authorizeRequests() .antMatchers("/resources/**","/css/**", "/images/**","/js/**", "/h2-cons.. 2022. 9. 6.
[ SpringBoot ] api test , jpa test 코드 @RunWith(SpringRunner.class) // 스프링부트테스트와 junit 사이의 연결자 기능 @ActiveProfiles("local") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ApiControllerTest { @LocalServerPort private int port; @Autowired private TestRestTemplate restTemplate; @Autowired private Repository repository; @Test public void insert() { String url = "http://localhost:" + port + "/api/v.. 2022. 8. 19.
스프링 서버 경로 구하기 //getRealPath() : 실제 톰캣이 돌아가고 있는 컴퓨터에서 그 곳의 절대 주소값 String rootPath = request.getSession().getServletContext().getRealPath("/"); //저장경로 1 String uploadPath = rootPath + "upload" ; 2 String uploadPath = request.getServletContext().getRealPath("/upload"); File path = new File(""); System.out.println(path.getAbsolutePath()); new File("").getAbsolutePath()+"/static/upload" 2022. 6. 15.
springBoot + react java 11 or 1.8 node 16 window 1. springBoot project 생성 2. reactProject 생성 //react project 생성 npx create-react-app test //프로젝트로 이동 cd test //프로젝트 실행 npm start //프록시 설정 npm install http-proxy-middleware --save 2-1 setUpProxy.js 생성 2-2 app.js 수정 import React, { useState } from 'react'; import logo from './logo.svg'; import './App.css'; function App() { // 요청받은 정보를 담아줄 변수 선언 // [상태값,세터함수] = useState.. 2022. 5. 6.
반응형