cancel
Showing results for 
Search instead for 
Did you mean: 

Hot to get user properties (email address)

michaelp
Confirmed Champ
Confirmed Champ
Hi,

How can I get the user's email address? First I need the username on the current user which starts an action.

String user = authenticationService.getCurrentUserName();


but I only get

Invalid property 'authenticationService' of bean class […]: Bean property 'authenticationService' is not writable or has an invalid setter method. Did you mean 'authentificationService'?


service-context.xml

<bean id="send-as-email" class="…" parent="action-executer">
        <property name="nodeService">
            <ref bean="NodeService"/>
        </property>
      <property name="contentService">
         <ref bean="ContentService"/>
      </property>
      <property name="personService">
         <ref bean="PersonService"/>
      </property>
      <property name="authenticationService">
         <ref bean="AuthenticationService"/>
      </property>


Can someone help me or give an example on how to get the current user's email address? I googled many times but found nothing I can use in my case.

Thanks in advance
2 REPLIES 2

openpj
Elite Collaborator
Elite Collaborator
In your class you should implement a public setter method for each service that you want to use.
In this case you should have these methods: setContentService, setPersonService, setAuthenticationService.

In this way you can allow Spring to correctly inject services inside your class.

Hope this helps.

OKAY !

DONT AKS WHY BUT … somehow it works now ^^

Dont know what I changed … I dont even remember I changed something … but i got the username and the email address now -.-

Strange ^^

Thank you anyway Smiley Happy