Java8 Stream을 이용 List -> int[] 로 변환하는 방법 int[] array = list.stream().mapToInt(i->i).toArray(); 1부터 10까지 데이터를 가진 Collection 생성 List list = Stream.iterate(0, n->n+1).limit(10).collect(Collectors.toList());int[] arr = (Stream.iterate(1, n->n+1).limit(10)).mapToInt(i->i).toArray(); Random 실수 생성 int[] randomNumbers = new Random().ints(10,0,350).toArray(); //(생성갯수, 최소값, 최대값)
1234567@Configurationpublic class WebConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedOrigins("*").allowedMethods("*"); }}Colored by Color Scriptercs WebMvcConfigurer의 addCorsMappings 재정의 해주면 된다. 현재 설정은 모든 path, origin, methods를 허용한다는 건데 각자의 상황에 맞게수정하면 된다. @Configuration을 적어줘야 적용된다. cors는 재시동 필요
macos에서 maven install시 아래와 같은 오류가 발생했을경우(환경이 java9일떄 방생하는 문제인듯) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigu)re/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBExcep..
Vue.js + Springboot 를 이용한 카페 리뷰 사이트 만들기를 시작합니다. 게시판형태에 웹어플리케이션으로 사진도 올리고 댓글도 달고 로그인도 하고 SNS연동도 하고(?) 실무 위주로 진행해 볼 예정입니다. 그리고 기술스택 프론트는 Vue.js를 백엔드는 Springboot + jpa를 이용한 API를 만들 예정입니다. 만들고 나서 여력이 된다면 백엔드부분을 node.js로 해봐도 재미있을꺼 같네요. 해당 프로젝트의 목표는 아래와 같습니다. Vue.js를 이용한 SPA 개발Springboot를 이용한 RestAPI 서버 개발반응형웹 css 작성 시작이 반이라니 우선 github부터 하나 만들고 let's get it! https://github.com/beans9/codingcafe 다음편에서 ..
vue-cli 실행시 아래와 같은 에러가 나올 경우 Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, 윈도우 환경이라면 명령어프롬프트(cmd)를 관리자 권한으로 실행 후 npm install -> npm run dev 해보도록 하자. if you use windows, open the cmd with administrator authority. and npm install -> npm run dev
명령어를 통해 설치가능한 버전 확인 yum list java*jdk-devel -> Available Packagesjava-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3 basejava-1.7.0-openjdk-devel.x86_64 1:1.7.0.161-2.6.12.0.el7_4 updatesjava-1.8.0-openjdk-devel.i686 1:1.8.0.161-0.b14.el7_4 updatesjava-1.8.0-openjdk-devel.x86_64 1:1.8.0.161-0.b14.el7_4 @updates 원하는 버전을 설치 yum install java-1.8.0-openjdk-devel.x86_64 설치 확인 java -version ->o..