Service bean failed to inject in spring cglib proxy
<p>I have an annotation</p>

<pre><code>@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface PartnerProxy {
}
</code></pre>

<p>And a Advice</p>

<pre><code>@Component
@Aspect
public class AnnotationAdvice {

    @Around("@annotation(PartnerProxy)")
    public Object pc(ProceedingJoinPoint joinPoint) throws Throwable {
        return joinPoint.proceed();
    }
}
</code></pre>

<p>And the bean i want to proxy</p>

<pre><code>public class OuterServiceProxy {

    private IRoomStatusService service;
    ... another properties

    String getRemoteHourRoomStatus(){
        return service.echo();
    }
    @PartnerProxy
    public void hello() {
    }
    ...getters &amp; setters
</code></pre>

<p>there is a property <code>IRoomStatusService service</code>, which is the point.
firstly if i declare  <code>OuterServiceProxy</code> in spring xml file</p>

<pre><code>&lt;bean id="outerServiceProxy" class="aop.jg.OuterServiceProxy"&gt;
        &lt;property name="service" ref="service"/&gt;
    &lt;/bean&gt;
</code></pre>

<p>and when <code>outerServiceProxy.getRemoteHourRoomStatus()</code> method is called, An NPE was thrown. I debug to that line [1]</p>

<pre><code>String getRemoteHourRoomStatus(){
        return service.echo();  [1]
    } 
</code></pre>

<p><code>service</code> is null. But <code>outerServiceProxy</code> is <code>OuterServiceProxy$$EnhancerByCGLIB$$b0b63bb6</code> actually enhanced by Cglib, but it seems <code>outerServiceProxy</code> just call <code>String getRemoteHourRoomStatus()</code> directly  and not through callback and call TargetSource, So <code>service</code> is null. But that make no sense!</p>

<p>When i add public modifier, <code>public String getRemoteHourRoomStatus()</code> everything goes fine. </p>

<p>And even more strange thing is that without <code>public</code> modifer, same code goes well in my PC, but NPE thrown in company testing environment. </p>