카테고리 없음

[Spring] 정적인 파일 경로 설정하기

Gh1324 2022. 1. 30. 20:59
728x90
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc
        https://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <bean name="/index" class="webprj.indexController"/>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/"/>
    <property name="suffix" value=".jsp"/>
</bean>

<mvc:resources location="/static/" mapping="/**"></mvc:resources>

</beans>

 

정적인 파일(img, css, js)들은 루트 webapp/static/안의 폴더에 넣어놓고 사용하면 된다.

728x90