servlet-contextに下部の通り記述し、起動時に読み込みます。
この際にエラーが出た際のハンドリングを以下の通り行いたいのですが、
なにか手段はございますでしょうか。
①エラーが出た際、該当Exceptionの内容を任意のログに出力したい。
(自分で指定したファイル名、パスに出したいということです。)
②起動時にエラーになってしまったら、以降サーブレットが呼び出される度に、呼出元に戻り値としてエラー表す値を返したい。
(String error ="error"程度のもの)
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --> <!-- Enables the Spring MVC @Controller programming model --> <annotation-driven /> <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --> <resources mapping="/resources/**" location="/resources/" /> <!-- 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:bean> <context:component-scan base-package="jp.co.mki" /> <beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <beans:property name="driverClassName" value="${jdbc.driverClassName}" /> <beans:property name="url" value="${jdbc.url}" /> <beans:property name="username" value="${jdbc.username}" /> <beans:property name="password" value="${jdbc.password}" /> </beans:bean> <context:property-placeholder location="classpath:ojdbc.properties" /> <beans:bean class="org.springframework.jdbc.core.JdbcTemplate"> <beans:constructor-arg ref="dataSource" /> </beans:bean>
</beans:beans>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。