Using AOP for non services

Sorry for the typos! I’ve edited the post

i hope u are not saying i sound junior man, i wrote that sample module for any to take a look and spent some minutes following out the dependency issues, that’s how i found aspectj in spring etc. any ways, i plan to spend on time on this in the future if none has taken a look then

Was just saying sometimes it’s nice to give more details on the actual changes you tried to make and the error message for those other changes.

Are you sure only including spring aspects automatically includes the aspectrj dependency?

You need to clean up the OpenMRS dependencies because they are missing in the api sub project which leads to compilation issues and the pointcut expression also needs to be fixed.

@k.joseph sorry that I haven’t been following this thread at all, but assuming your use case is to track login/logout events, you could consider contributing this as an openmrs-core feature, rather than trying to catch it via AOP.

For example in core we have PrivilegeListener and in fact this is used within UserContext (see here). It seems appropriate to add an analogous listener for login/logout events.

1 Like

sure thanks @darius for the suggestion, i completely agree, actually looking through that pivilegeLister made me figure out some previous hasPrivilege issue.

I have this morning had some minutes on this and wired a pull request through

Sounds good to add it as a core feature but I was guessing he was looking for a short term solution before a new version with the feature is released.

am actually happy building off the latest core since i suspect more feature contributions our current project may get into core