我正在使用GWT 2.4和Spring 3.1,我想用Spring Security保护我的应用程序.我一直在寻找一个没有单独的JSP登录页面的GWT解决方案.我发现只有使用JSP进行登录的旧站点,因此该线程可以产生一种解决方案,以标准方式将GWT与Spring Security完全集成.无论如何,如果有一个已成功完成此操作的引用,则可以使用指向该引用的链接关闭该线程.
到目前为止,这是我的第一个方法:
ApplicationContext的-security.xml文件:
<http auto-config="false" use-expressions="true" entry-point-ref="customAuthenticationEntryPoint">
<intercept-url pattern="/ApplicationScaffold.html" access="permitAll" />
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
</http>
<beans:bean id="customAuthenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"
c:loginFormUrl="/ApplicationScaffold.html" />
<!-- Configure Authentication mechanism -->
<authentication-manager alias="authenticationManager">
<authentication-provider>
...
</authentication-provider>
</authentication-manager>
Run Code Online (Sandbox Code Playgroud)
ApplicationScaffold.html(我的应用程序是使用Spring Roo创建的)是包含GWT登录页面的起始页面.
web.xml中:
<display-name>securitytest</display-name>
<description>Roo generated application</description>
<!-- Enable escaping of form submission contents -->
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
</context-param>
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>HttpMethodFilter</filter-name> …Run Code Online (Sandbox Code Playgroud) 我有一个带有GWT的Spring Roo应用程序.在服务器端,我为所有实体提供了简单的JpaRepository接口,例如:
@Repository
public interface MyEntityRepository extends JpaSpecificationExecutor<MyEntity>, JpaRepository<MyEntity, Long> {
}
Run Code Online (Sandbox Code Playgroud)
有一个MyEntity类与MyOtherEntity类具有一对一的关系.当我调用我的实体服务持久化方法时
public void saveMyEntity (MyEntity myEntity) {
myEntityRepository.save(myEntity);
}
Run Code Online (Sandbox Code Playgroud)
只保存myEntity对象.MyEntity的所有子对象都将被忽略.保存myEntity对象和myOtherEntity对象的唯一方法是调用
myOtherEntityRepository.save(myOtherEntity);
Run Code Online (Sandbox Code Playgroud)
在上面的代码之前.那么使用JpaRepository接口自动保存子对象有更优雅的方法吗?