小编D. *_*ski的帖子

如何在Spring MVC中设置缓存头?

在基于注释的Spring MVC控制器中,为特定路径设置缓存头的首选方法是什么?

java spring caching spring-mvc

60
推荐指数
6
解决办法
8万
查看次数

如何在Spring Security中使用自定义角色/权限?

在将旧应用程序迁移到spring安全性时,我遇到以下异常:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainProxy': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainList': Cannot resolve reference to bean '_filterSecurityInterceptor' while setting bean property 'filters' with key [3]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterSecurityInterceptor': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [superadmin]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
Run Code Online (Sandbox Code Playgroud)

在旧的应用程序中,有"superadmin","editor","helpdesk"等角色.但是在所有Spring Security示例中,我只看到像"ROLE_"("ROLE_ADMIN"等)这样的角色.当我将"superadmin"重命名为"ROLE_ADMIN"并且仅在配置中使用此角色时,一切正常.

不起作用:

 <http auto-config="true">                                      
    <intercept-url pattern="/restricted/**" access="superadmin"/>
    <form-login
        authentication-failure-url="/secure/loginAdmin.do?error=true" …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

31
推荐指数
3
解决办法
7万
查看次数

是否可以在Eclipse中使用键盘快捷键启动/停止Tomcat?

我试图尽可能在没有鼠标的情况下在Eclipse中工作.我无法在Eclipse WTP(Web Tools Platform)中找到用于快速启动和停止服务器的键绑定.

启动服务器的一种方法是切换到软件包资源管理器(Alt+ Cmd+ Q P),选择项目(向上/向下箭头),然后选择"在服务器上调试"-key绑定(在Mac上为Shift+ Alt+ D R).但这需要太多步骤.

java eclipse tomcat

10
推荐指数
1
解决办法
7405
查看次数

如何防止JPA回滚交易?

调用的方法:
1.Struts Action
2.服务类方法(由@Transactional注释)
3.Xfire webservice调用

包括struts(DelegatingActionProxy)和事务在内的所有东西都是用Spring配置的.

使用JPA/Hibernate完成持久化.

有时web服务会抛出一个未经检查的异常.我捕获此异常并抛出一个已检查的异常.我不希望事务回滚,因为Web服务异常会更改当前状态.我已经注释了这样的方法:

@Transactional(noRollbackFor={XFireRuntimeException.class, Exception.class})
public ActionForward callWS(Order order, ....) throws Exception
  (...)
  OrderResult orderResult = null;

  try {
    orderResult = webService.order(product, user)
  } catch (XFireRuntimeException xfireRuntimeException) {
    order.setFailed(true);
    throw new WebServiceOrderFailed(order);
  } finally {
    persist(order);
  }
}
Run Code Online (Sandbox Code Playgroud)

我仍然得到这个例外:

org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
Run Code Online (Sandbox Code Playgroud)

当我尝试使用junit重现此事务时,事务未标记为回滚,并且仍可以提交事务.

如何让Spring不回滚事务?

java spring struts hibernate jpa

9
推荐指数
1
解决办法
5万
查看次数

使用Spring 3.0中的SpEL替换JSP中的EL

厌倦了JSP中的旧EL无法调用bean等方法.

我可以在JSP中使用Spring 3.0中的SpEL吗?

java spring jsp jstl spring-mvc

9
推荐指数
1
解决办法
8650
查看次数

将grails集成到现有的spring应用程序中?

如果您不想为grails启动单独的项目,而是将其隐藏到现有的Web应用程序中,该怎么办?

我必须为一些新实体构建一个管理界面/ crud,并认为这将是学习grails的完美方式.

java grails spring

8
推荐指数
1
解决办法
1580
查看次数

无法在新安装的mac上以调试模式启动eclipse中的应用程序

我重新安装了雪豹(10.6.4)并且它已经完全更新了.运行java -version告诉我:
Java版"1.6.0_20"
Java(TM)SE运行时环境(版本1.6.0_20-b02-279-10M3065)
Java HotSpot(TM)客户端VM(版本16.3-b01-279,混合模式) )

我安装了一个新版本的eclipse(helios,3.6,build:20100617-1415).

我创建一个新的java项目,添加一个简单的测试用例:

public class TestMyEclipse {  
      @Test  
      public void testIt() {  
       assertTrue(true);  
      }  
}
Run Code Online (Sandbox Code Playgroud)

当我在eclipse中以正常模式运行它时,它按预期工作.但是当我在调试模式下运行时,我收到以下错误:

Invalid memory access of location 0x14 rip=0x1007f9d22
Run Code Online (Sandbox Code Playgroud)

java eclipse macos

3
推荐指数
1
解决办法
3511
查看次数

如何捕获浏览器中applet生成的网络流量

我想知道浏览器中的Java applet如何与服务器通信.有可能捕获网络流量吗?

language-agnostic

2
推荐指数
1
解决办法
1372
查看次数

是否有理由不使用Pressflow而不是Drupal 6?

在构建Drupal 6站点(mysql + php5)时,是否有任何理由不在生产服务器上使用Pressflow?

drupal drupal-6 pressflow

2
推荐指数
1
解决办法
714
查看次数