AnsweredAssumed Answered

spring dependency injection issue

Question asked by pmarreddy on Jan 16, 2006
Latest reply on Jan 16, 2006 by pmarreddy

we are exploring alfreco for a while, its a great product, we are considering to provide content services which would have been very difficult with out alfresco.

i have some issues in trying to use spring dependency injection, it would be great if somebody can figure out the solution.

<bean id="initTest" class="org.alfresco.example.inittest"  >
       <property name="authenticationService">
            <ref bean="authenticationService" />

i have defined this in application-context.xml in repository and used it in the following way.

package org.alfresco.example;

import org.springframework.context.ApplicationContext;

public class inittest {
      private AuthenticationService authenticationService;
      public void setAuthenticationService(AuthenticationService authenticationService)
        this.authenticationService = authenticationService;
      public void login() throws Exception
         ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
         authenticationService.authenticate("admin", "admin".toCharArray());

i am getting

Exception in thread "main" java.lang.NullPointerException
   at org.alfresco.example.inittest.login(
   at org.alfresco.example.loggie.main(