[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] DI Constructor issue
|
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Fri, 4 Jun 2010 11:02:12 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=x63WPKolYKZeVhmd446HWkX2pYr9hdmJA/VYpTXzcDE=; b=QQ9598FS+Qv3dJhaSig2S/cra96KX+3uByIrRstsFQWEHRG3Nb/+knbkB4qJWB/ahj 3/slTUwGEXD3VAa92mspUr6Mzoa9IODEYL183tMrrEEvSyy/1PeSfV3vMnHP82ZY8bAG JgAq4rn3O2BUd3X5FhLL1gWFI9/NAYhnr7IHs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=WbRyJ/7DqiOxHqNCVNiG3iC7dV4vTyvqZKKisD2RQEaBa4K9LrcD28v7CRtjvPgL6v cwbKmB5bEwRXLWpX1QeqpvPOeSQtL9ivZH/VWI03Lr151HUlkh1YUpNPqgDsXt1hJtt9 oQcmaaL40awDkK1xJKPKNLRf5cWhI2JmO4MF0=
Hi,
You might have more luck with this question on the Spring AOP forums at:
http://forum.springsource.org/forumdisplay.php?f=31
I'm not an expert (although I really ought to be...) on the spring
configuration with AspectJ.
cheers,
Andy
On 3 June 2010 03:54, Yetti <elliot.trussell@xxxxxxxxxxxxx> wrote:
>
> Hi,
>
> Ive just started using aop for some simple logging in a new project. Ive
> read through quite a few threads and various sites but cant seem to quite
> understand why Im getting the problem.
>
> I am using Spring 2.5.5 to inject various classes for a JMS project and also
> using the schema based spring-aop namespace due to being restricted to
> 1.4jvm. I am also using aspectJ 1.5.4.
>
> The problem is that although logging seems to work fine for any classes that
> use a default constructor, classes that have constructors with args; 1. dont
> get logging and 2. throw an error within the DI that seems to be a
> nullpointer issue, Im only guessing at this as no info is given.
>
> What I also dont understand is that I am using the method pointcut pattern
> so why is this causing a problem with the constructor?
>
> Heres my code, Hope Im not just being dumb (though most likely!)
>
> <bean id="sonicConfig"
>
> class="com.homeserve.guidewire.plugins.messaging.edi.outbound.transport.SonicConfig">
> <constructor-arg
> value="SonicBroker=tcp://hgbsmdev02.hgb.hs.int:2531;SonicUsername=Administrator;SonicPassword=Administrator"
> />
> </bean>
>
> <bean id="aopLogging"
>
> class="com.homeserve.guidewire.plugins.messaging.edi.logging.LoggingInterceptor">
> </bean>
>
> <aop:config proxy-target-class="false">
> <aop:aspect id="aopLoggingAspect" ref="aopLogging">
>
> <aop:pointcut id="loggingPointCut"
> expression="execution( *
> com.homeserve.guidewire.plugins.messaging.edi.outbound..*.*(..))" />
>
> <aop:around method="aopLogging" pointcut-ref="loggingPointCut" />
>
> </aop:aspect>
> </aop:config>
>
> public SonicConfig(String sonicConnectionString) throws ParseException
> {
> this.sonicConnectionString = sonicConnectionString;
> parseSonicConnectionString();
> }
>
> public class LoggingInterceptor {
>
> public Object aopLogging(ProceedingJoinPoint pjp) throws Throwable{
> Logger log = Logger.getLogger(LoggingInterceptor.class);
> Object retValue = null;
> Object[] args = pjp.getArgs();
> try {
>
> StringBuffer entering = new StringBuffer();
> StringBuffer leaving = new StringBuffer();
> Signature sig = pjp.getSignature();
> String clazz = pjp.getSignature().getDeclaringType().getName();
> entering.append(clazz.substring(clazz.lastIndexOf(".")+1,
> clazz.length()));
> entering.append(".");
> entering.append(sig.getName());
> entering.append("(");
> leaving.append(entering.toString());
> for (int i = 0; i < args.length; i++) {
> if (i > 0) {
> entering.append(", ");
> }
> entering.append(args[i]);
> }
> entering.append(")]");
> SourceLocation sl = pjp.getSourceLocation();
> log.info("Entering [" + entering);
>
> retValue = pjp.proceed();
>
> leaving.append(")");
> log.info("Leaving [" + leaving + " Return value: " + retValue);
>
> }
> catch (Exception e)
> {
> log.error(e);
> }
> return retValue;
> }
> }
>
> Thanks
> Yetti
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/DI-Constructor-issue-tp2241500p2241500.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>