다른 블로그에서는 분명

<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" id="viewResolver" p:order="0">
2<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" id="jsonView">
3    <property name="contentType" value="application/json;charset=UTF-8">
4</property></bean>
5</bean>

이렇게 사용하라고 했지만


결론은...


HTTP Status 500 - Servlet.init() for servlet bbs threw exception

500에러가 발생한다
그 이유는 

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>


dependency를 넣지 않아서도 아니고


<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/WEB-INF/vm/"/>
</bean>

<bean id="velocityViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
<property name="suffix" value=".vm"/>
</bean>

<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" id="viewResolver"/>
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" id="jsonView">
<property name="contentType" value="application/json;charset=UTF-8">
</property>
</bean>

왠지 velocity와 같이 사용해서 인 것같다....


그래서 다른블로그들 말만 믿고 에러만 쳐다보다가

결국 찾은 ViewResolver가 바로


<bean id="beanNameResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"/>


바로 InternalResourceViewResolver

이 분이다. 에러는 커녕 너무 잘 돌아가줘서 고맙다

Posted by 010562