spring sample

Hello,

I'm trying to run the "spring" sample; I'd like to use the "authorization" by annotation features of jsecurity. As I don't know how to deploy the web app, I've tryed to run directly the WebStartView as a standalone java app. When I launch it, I get the following error:

Exception in thread "main" java.lang.NullPointerException
at org.jsecurity.samples.spring.DefaultSampleManager.getValue(DefaultSampleManager.java:65)
at org.jsecurity.samples.spring.ui.WebStartView.updateValueLabel(WebStartView.java:127)
at org.jsecurity.samples.spring.ui.WebStartView.afterPropertiesSet(WebStartView.java:82)
at org.jsecurity.samples.spring.ui.WebStartView.main(WebStartView.java:162)

So, I have added the following code in the main method:

WebStartView test = new WebStartView();
test.setSampleManager(new DefaultSampleManager());

DefaultSecurityManager securityManager = new DefaultSecurityManager();
SecurityUtils.setSecurityManager( securityManager );

test.afterPropertiesSet();

The swing UI seems to work correctly, but if I change the @RequiresPermissions("permission2") annotation in SampleManager to any dummy value (for example "dummy" instead of "permission2"), the secureMethod3 method still remains called successfully instead of raising an Unauthorized exception. So, it seems that the annotations are not taken into account.

I am probably missing something ...

Thank you for your help

Issue solved

After realizing that I was missing all the spring initialisation stuff to anable annotation management, and after adapting the authencation part that was performed through the web UI, I finally managed to make it work.

Re: Issue solved

Hi Rod,

Sorry for the delayed reply - I was out of town for a while and then moved my home last week. If you experience this type of delay again, please direct the question(s) to the user mailing lists - they're usually more responsive now that we've moved to Apache.

I'm glad you got it to work!

Regards,

Les