<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
beans
xmlns
=
"http://www.springframework.org/schema/beans"
xmlns:xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:context
=
"http://www.springframework.org/schema/context"
xsi:schemaLocation="
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">
<
context:component-scan
base-package
=
"controller"
/>
<
context:component-scan
base-package
=
"service"
/>
<
context:component-scan
base-package
=
"dao"
/>
<
bean
class
=
"org.springframework.web.servlet.view.InternalResourceViewResolver"
id
=
"internalResourceViewResolver"
>
<
property
name
=
"prefix"
value
=
"/WEB-INF/jsp/"
/>
<
property
name
=
"suffix"
value
=
".jsp"
/>
</
bean
>
<
bean
class
=
"org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"
>
<
property
name
=
"defaultErrorView"
value
=
"error"
></
property
>
<
property
name
=
"exceptionAttribute"
value
=
"ex"
></
property
>
<
property
name
=
"exceptionMappings"
>
<
props
>
<
prop
key
=
"exception.MyException"
>my-error</
prop
>
<
prop
key
=
"java.sql.SQLException"
>sql-error</
prop
>
</
props
>
</
property
>
</
bean
>
</
beans
>