전체 글
-
스프링 레거시 프로젝트 톰캣 구동시 시작 url 설정http 웹기본지식 2024. 9. 4. 15:32
보통 스프링 프로젝트를 생성한 후 톰캣으로 구동하면 프로젝트명이 시작 url 로 설정되어있다.만약 프로젝트를 springTest으로 생성하고 해당 프로젝트를 톰켓으로 구동하면 http://localhost:8080/springTest 으로 url 이 설정된다. 이유가 뭘까?그 이유는 톰캣의 path 에 프로젝트명이 자동으로 설정되기 때문이다.만약 저 부분을 /로 변경하면 http://localhost:8080/ 으로 url 이 설정된다. 그럼 의문이 들수있다. 저게 변경되면 controller url 매핑도 다 / -> /springTest 로 변경해야하는거 아닌가?아래 url 접근 원리를 보면 url 매핑을 변경하지 않아도 된다는 것을 알 수 있다. url 접근 원리스프링의 URL 매핑이 톰캣의 컨텍스..
-
spring실전 개발자를 위한 spring framework 2024. 8. 17. 12:35
1.spring framework란?java 엔터프라이즈 개발을 편하게 해주는 오픈소스 경량 프레임워크개발자가 복잡하고 실수하기 쉬운 low level에 많이 신경 쓰지 않으면서 비즈니스 로직 개발에 전념할 수 있게 도와줌2002년 로드존슨이 출판한 도서에서 근간이 되어 현재까지 널리 사용되고 있는 자바기반 프레임워크2.spring framework 특징컨테이너 존재(ioc 컨테이너) : spring 컨테이너는 java 객체의 life cycle 을 관리하며 컨테이너로 부터 필요한 객체를 가져와 사용한다di 지원 : 객체간의 의존관계를 설정하면 ioc 컨테이너가 알아서 객체주입을 해주는 개념aop 지원 : 핵심 모듈과 부가기능을 분리하여 개발할 수 있다.트랜잭션 처리를 위한 일관된 방버 지원영속성과(데이..
-
자동주입과 자주사용하는 어노테이션 정리spring framework 2024. 3. 22. 09:16
1.@Restcontroller: Spring MVC에서 컨트롤러 클래스를 정의할 때 사용되는 어노테이션 중 하나입니다. 이 어노테이션은 Controller와 ResponseBody 어노테이션을 합친 것입니다. Controller: Spring MVC에서 컨트롤러 클래스를 정의할 때 사용되는 어노테이션으로, 해당 클래스를 웹 요청을 처리하는 컨트롤러로 지정합니다. ResponseBody: 해당 메서드가 반환하는 데이터를 HTTP 응답 본문에 직접 쓰도록 지정하는 어노테이션입니다. RestController는 이 두 가지 역할을 한 번에 수행합니다. 즉, RestController가 붙은 클래스의 모든 메서드는 HTTP 요청에 대해 자동으로 ResponseBody를 적용하여 반환된 데이터를 HTTP 응답 ..
-
-
-
-
-
boot 구조 및 메인화면 실행java spring boot 2022. 9. 21. 19:33
처음 start 프로젝트가 생성되면 controller 패키지 없이 boot1Application 클래스만 존재한다. Application 클래스는 결과적으로 boot를 구동하는 역활을 수행한다. 구체적으로 하는 일을 나열해보자면 다음과 같다. @SpringBootConfiguration -> 현재 클래스가 Spring의 설정 파일임을 알려주는 어노테이션 @ComponentScan -> 다른 컴포넌트, 서비스, 설정 등을 찾을 수 있게 도와주는 어노테이션 -> 즉 자바 클래스를 스프링 빈이라고 표시하고 스프링의 component-scanning 기술을 통해 ApplicationContext에 빈으로 등록하게 하는 역할 @EnableAutoConfiguration -> Spring boot 클래스패스 세팅..