-
(9주차 59일) STS4 설치, 톰캣 설정, 프로젝트 생성수업 내용 정리 2024. 7. 9. 17:47
JAVA 환경변수 설정
- vi ~/.zshrc에 환경변수 설정
- vim 수정(i)
- 저장하고 나가기(:wq) - maven PATH 지정
export MVN=/Users/hyeonji/eclipse-workspace/apache-maven-3.9.8
export PATH=$PATH:$MVN/bin - Java PATH 지정
export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
export PATH=${PATH}:/Library/Java/VirtualMachines/temurin-21.jdk/Contents/Home
STS4 설치
- STS4 파일 설치
- sts-bundle 폴더로 파일 이동 -> Java 버전 설정
*참고
[ macOS 맥북 ] STS4 (Spring Tool Suite 4) 설치
macOS 맥북에서 STS4 (Spring Tool Suite4) 를 설치하는 방법입니다. 1. JAVA 설치 및 환경변수 설정 일단! STS4 도 이클립스와 마찬가지로 설치 전 JAVA 가 설치되어 있어야 합니다. JAVA 설치 및 환
eunoia3jy.tistory.com
톰캣 설정
- setting -> server -> runtime environment -> 톰캣 경로 추가
- 톰캣 옵션에서 설정 -> Server Option -> Serve modules without publishing 체크
Maven 프로젝트 생성
1. maven-archetype-quickstart 실행
2. Pom.xml에서 자바 버전 변경 -> maven - update project
3. 단위 테스트를 위해 mvnrepository에서 junit, assertj 버전 dependencies 추가(Pom.xml)
4. 클래스에서 Cmd + 1 -> JUnit 테스트 생성
Spring Bean File 생성
- 마켓플레이스 : Spring tools 3 add 설치
- resources 폴더에 Spring Bean Definition 생성(Configuration file)
-> name 입력: spring/root-context.xml
-> beans, context, c, p 체크, 버전 맨 위(최신버전)
-> root_context.xml 파일 내부 beans 주소에서 세팅할 수 있다.
* OwnerTest에서
@Test
@Test
void genericXmlApplicationContextTest() {
//기본적으로 클래스 패스를 기준으로 파일을 찾는다.
//ApplicationContext context = new GenericXmlApplicationContext("spring/root-context.xml");
ApplicationContext context = new GenericXmlApplicationContext("classpath:spring/root-context.xml");
Owner owner = context.getBean("hong", Owner.class);
System.out.println(owner);
assertThat(context).isNotNull();
}
* root-context.xml 파일에서 <beans> 태그에서 오류가 발생하는 경우 설정
: Download external resources like referenced DTD, XSD 체크'수업 내용 정리' 카테고리의 다른 글
(9주차 61일) AOP, STS4 Spring MVC Project 구동 (0) 2024.07.12 (9주차 60일) STS4 설정, 스프링 DI (0) 2024.07.10 (8주차 52일) JSP 구성, 내장 객체 (1) 2024.07.02 (8주차 51일) Servlet, html (0) 2024.07.01 (7주차 48일) 톰캣, 환경 설정 (0) 2024.06.28 - vi ~/.zshrc에 환경변수 설정