为什么@Secured 在 Tapestry 5.4.0 中不起作用?

Why @Secured is not working in Tapestry 5.4.0?

我刚刚将 Tapestry 5.3.8 升级到 5.4.0,然后我发现 @Secured 注解有问题。如果我转到具有此 @Secured 的页面,将抛出异常 org/apache/tapestry5/services/TransformMethodSignaturecould not initialize class nu.localhost.tapestry5.springsecurity.services.internal.TransformConstants2(没有详细信息)。 5.4.0不再支持了吗?或者我需要升级我的 pom.xml 中的某些东西吗?

pom.xml

<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-core</artifactId>
    <version>${tapestry-release-version}</version>
</dependency>

<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-hibernate</artifactId>
    <version>${tapestry-release-version}</version>
</dependency>

<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-upload</artifactId>
    <version>${tapestry-release-version}</version>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>4.2.0.Final</version>
</dependency>

<dependency>
    <groupId>com.mchange</groupId>
    <artifactId>c3p0</artifactId>
    <version>0.9.5.2</version>
</dependency>

<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-spring</artifactId>
    <version>${tapestry-release-version}</version>
</dependency>

<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-kaptcha</artifactId>
    <version>${tapestry-release-version}</version>
</dependency>

<dependency>
    <groupId>org.got5</groupId>
    <artifactId>tapestry5-jquery</artifactId>
    <version>4.1.1</version>
</dependency>

<dependency>
    <groupId>com.github.lltyk</groupId>
    <artifactId>tapestry-spring-security</artifactId>
    <version>3.0.3</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.3.0.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>4.3.0.RELEASE</version>
    <scope>test</scope>
</dependency>

好吧,折腾了好几天,终于弄明白了这个库:

<dependency>
    <groupId>com.github.lltyk</groupId>
    <artifactId>tapestry-spring-security</artifactId>
    <version>3.0.3</version>
</dependency>

跟不上 Tapesty 5.4,因为它有一个 class: nu.localhost.tapestry5.springsecurity.services.internal.TransformConstants2 指的是 org.apache.tapestry5.services.TransformMethodSignature 在 Tapestry 5.4 中不再可用。

我已经尝试将 tapestry-spring-security 升级到最高版本:3.0.5,但仍然跟不上 Tapestry 5.4,所以解决它的唯一方法是将其删除。为了替换 tapestry-spring-security 提供的所有功能,我需要向 pom 添加 4 个新库(在您的情况下,您可能需要添加多于或少于 4 个):spring-security-core: 4.0.0 .M1, spring-security-web: 4.2.3.RELEASE, spring-dao: 2.0.8, servlet-api: 2.5

就我而言,我需要从这些 classes 的原始来源复制代码:LogoutService (interface), LogoutServiceImpl, IfRole and IfLoggedIn。创建文件并粘贴代码。