Spring security 使用Jersey和Spring Security的安全方法

Spring security 使用Jersey和Spring Security的安全方法,spring-security,jersey,jsr250,Spring Security,Jersey,Jsr250,我试图在SpringBoot(1.2.5)应用程序的Jersey(2.x)rest控制器上添加安全性。我的项目使用SpringBootStarter:web、安全和jersey Spring安全配置 @EnableGlobalMethodSecurity(jsr250Enabled = true) @EnableWebMvcSecurity public class WebConfiguration extends WebMvcConfigurerAdapter {} 泽西岛休息控制器 @Na

我试图在SpringBoot(1.2.5)应用程序的Jersey(2.x)rest控制器上添加安全性。我的项目使用SpringBootStarter:web、安全和jersey

Spring安全配置

@EnableGlobalMethodSecurity(jsr250Enabled = true)
@EnableWebMvcSecurity
public class WebConfiguration extends WebMvcConfigurerAdapter {}
泽西岛休息控制器

@Named
@Path("test")
public class JerseyEndPoint {

    @GET
    @RolesAllowed("ADMIN")
    public String message() {
        return "Hello";
    }

}
@RestController
public class SpringEndPoint {

    @RequestMapping(value = "test", method = RequestMethod.GET)
    @RolesAllowed("ADMIN")
    public String message() {
        return "Hello";
    }
}
安全性不起作用(任何用户都可以访问rest控制器) 但是安全性与Spring控制器一起工作

@Named
@Path("test")
public class JerseyEndPoint {

    @GET
    @RolesAllowed("ADMIN")
    public String message() {
        return "Hello";
    }

}
@RestController
public class SpringEndPoint {

    @RequestMapping(value = "test", method = RequestMethod.GET)
    @RolesAllowed("ADMIN")
    public String message() {
        return "Hello";
    }
}

提前感谢您的帮助

和?问题/解决方案是什么?以及?问题/解决方案是什么?