Spring Setting_5

양혜정·2024년 6월 22일
0

spring

목록 보기
5/7

Servlet-context.xml

18. 이미지, 동영상, js, css 파일등이 위치하는 경로를 의미한다.

  • <mvc:annotation-driven /> 아래
<!-- ==== #18. 이미지, 동영상, js, css 파일등이 위치하는 경로를 의미한다. -->
	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
	<mvc:resources mapping="/resources/**" location="/resources/" />

19.


20. 실행시 모든 페이지에 기본틀이 되어지는 틀을 배치하기 위한 템플릿 프레임워크인 TilesViewResolver 를 사용하기 위해 빈으로 등록한다.

  • 이어서 붙여넣기
<!-- ======= #20. 실행시 모든 페이지에 기본틀이 되어지는 틀을 배치하기 위한 템플릿 프레임워크인 TilesViewResolver 를 사용하기 위해 빈으로 등록한다. ======= -->
   <beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
        <beans:property name="definitions">
            <beans:list>
                 <beans:value>/WEB-INF/tiles/tiles-layout.xml</beans:value>
            </beans:list>
        </beans:property>
    </beans:bean>
  • 우선순위 설정
<beans:bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <beans:property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView" />
        <beans:property name="order" value="1"/>
    </beans:bean>
    
	<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
	<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<beans:property name="prefix" value="/WEB-INF/views/" />
		<beans:property name="suffix" value=".jsp" />
		<beans:property name="order" value="2"/>
	</beans:bean>

21.


22. AOP 관련 어노테이션 동작이 가능하게 설정

  • </beans:beans>
<!-- ===== #22. 일단 스프링에서 트랜잭션 처리를 하기 위해서는
      	먼저 src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml 파일에
        Namespaces 에 aop를 체크를 하고, 아래와 같이 트랜잭션 처리를 위한 aop 포인트컷을 등록을 해야 한다.    
       	- 아래의 <aop:aspectj-autoproxy />가 AOP 관련 어노테이션 동작이 가능하게 설정해주는 것임.
    -->   
   <!--  AOP 관련 어노테이션 동작이 가능하게 설정 -->   
   	<aop:aspectj-autoproxy /> <!-- 추가 -->        
    
   	<aop:config proxy-target-class="true">
   		<aop:pointcut id="controllerOperation" expression="execution(public * com.spring.app..*Controller.*(..))" />
   	</aop:config>

0개의 댓글

관련 채용 정보