Announcement Announcement Module
No announcement yet.
setup spring-config-xml Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • setup spring-config-xml

    Hi everybody,

    I'm trying to setup an exception handling using spring aop.
    In fact I found an introduction (
    but I'm having a few problems to configure my spring-config.xml.

    F.ex. I defined a bean in my applicationContext for a service:
    <bean id="myService" class="package.MyService"></bean>
    In this bean I throw a Exception which I want to catch in my own ExceptionHandler.

    So how do I have to configure the spring-config.xml?
    My approach:
    ?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC
        "-//SPRING//DTD BEAN//EN"
        <!-- Bean configuration -->
        <bean id="businesslogicbean" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="proxyInterfaces">
            <property name="target">
                <ref local="beanTarget" />
            <property name="interceptorNames">
        <!-- Bean Classes -->
        <bean id="beanTarget" class="package.MyService" />
        <!-- Advisor pointcut definition for before advice -->
        <bean id="theTracingThrowsAdvisor"
            <property name="advice">
                <ref local="theTracingThrowsAdvice" />
            <property name="pattern">
        <!-- Advice classes -->
        <bean id="theTracingThrowsAdvice"
            class="package.ExceptionHandler" />
    This doesn't work.
    I even don't know how to handle the proxyInterface? Do I have to have one??

    Thanks in advance!

  • #2
    Spring reference clearly defines what 'proxyInterfaces' property stands for - 7.5.3. JDK- and CGLIB-based proxies.

    Also I'd recommend you to use Spring2 aop - 6. Aspect Oriented Programming with Spring. It's more convenient and provides transparent aspectj integration in the case of @AspectJ configuration style usage.