Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616654
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:00:47+00:00 2026-05-22T02:00:47+00:00

I am using aspectJ class for Exception Handling aspect in Spring. i need to

  • 0

I am using aspectJ class for Exception Handling aspect in Spring.
i need to read values from properties files which is defined in spring bean.
Presently I am reading property file using the context.
is there any other option.
earlier while i was using spring aop ,proxy object automatically read the properties file without accessing through the context.

Spring Config File

<bean id="applicationProperties"
    class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    <property name="location">
        <value>classpath:/resources/config/application.properties</value>
    </property>
</bean>

public Properties exceptionProp = null;

ExceptionHandlingAspect Class(i have to use context for reading propeties here)

 public class ExceptionHamdlingAspect{

public void setExceptionProp(Properties exceptionProp) {
    this.exceptionProp=exceptionProp;
}

 @AfterThrowing(pointcut = "ExceptionHandlingAspect()", throwing = "ex")
public void logAfterThrowingException(final JoinPoint currentJp,
        Throwable ex) throws Exception {

ApplicationContext ctx = AppContext.getApplicationContext();
this.exceptionProp=(Properties) ctx.getBean("applicationProperties");   


PropertyReader.getValueForProperty(ex.getClass().getSimpleName(),exceptionProp);
System.out.println("error values :"+errorString[0]+ errorString[1]);


}

 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:00:47+00:00Added an answer on May 22, 2026 at 2:00 am

    You can wire up your aspect using the static aspectOf factory method (you can’t see that method, it is added by the aspectj compiler)

    <bean class="com.YourAspect" factory-method="aspectOf">
        <property name="exceptionProp"
                  value="classpath:path/to/propfile.properties" />
    </bean>
    

    Reference:

    • aspectOf() and hasAspect()
      methods
    • Spring Dependency Injecting an
      annotated Aspect
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a generic collection class which I can add to, and enumerate over.
I am using Spring's declarative transactions (the @Transactional annotation) in aspectj mode. It works
I'm using Spring 3.x, Java 6. I have an @Around aspect with the following
I'm using Spring 3.0.5 with an Around aspect. The @Around aspect works perfectly. The
I am using Datanucleus, JDO and Spring's declarative @Transactional management woven with Aspect-J. But
Using Spring and Java; I have a pointcut which works OK. Now I want
When using Aspect Oriented Programming with Policy injection, how do you deal with policy
In my Spring context file I have something like this: <bean id=userCheck class=a.b.c.UserExistsCheck/> <aop:config>
I need to create an aspect with a pointcut matching a method if: it
Hi I am using Spring Roo to create a service to access the data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.