I use spring-roo to generate my project. I don't know these 2 things are related or not, but in Controller, none of the annotation @Async or @Secure works.
For @Secure:
I added <global-method-security secured-annotations="enabled"/>
tag to applicationContext-security.xml and modified the pom.xml to meet dependency,
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-aspects</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
above the method in the controller, I added @Secured("ROLE_ADMIN")
but no matter what role everybody can access the method. Anything I missed to configure to make the @Secure Active?
For @Async: In applicationContext.xml, I added
<task:annotation-driven executor="asyncExecutor"/>
<task:executor id="asyncExecutor" pool-size="${executor.poolSize}"/>
in controller.java:
@Async
private void justWait20seconds() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
I expect this method will not block the main method, but it didn't. These 2 tag are all in my UserController.java, I don't know whether they are linked. Can anyone help?