Tag: 弹簧

user-by-username-query需要多于1个参数

我必须实现一个弹簧安全件,它有超过1个参数来获取用户。 它将通过其ID和产品名称获取用户。 我知道user-by-username-query只能给出一个参数,我想知道是否有可能给出许多用户 – 用户名 – 查询选项并给他们一些ID,但我不知道如何在validation时会引用。 有没有人有什么建议

使用spring security时如何在速度宏中获取csrf令牌

我正在尝试为启用spring web security的应用程序创建自定义登录屏幕,我无法弄清楚如何将csrf标记传递给velocity(不,我目前无法使用JSP)。 该模型看起来像这样: @RequestMapping(value = “/login”, method = RequestMethod.GET) public ModelAndView login( @RequestParam(value = “error”, required = false) String error, @RequestParam(value = “logout”, required = false) String logout ModelAndView model = new ModelAndView(); if (error != null) { model.addObject(“error”, “Invalid username or password!”); } if (logout != null) { model.addObject(“msg”, “You’ve been logged out […]

VelocityEngineUtils已经在Spring 3.2中删除了,还有什么可以使用的?

今天我将整个Spring Web应用程序从使用Spring 3.1.1升级到Spring 3.2 。 除了在Spring 3.2 ,我的现有应用程序的大多数部分都没有破坏 org.springframework.ui.velocity.VelocityEngineUtils class似乎完全从spring-context-3.2.0.RELEASE.jar中删除 。 我在此url中找到了迁移指南。 它声明org.springframework.ui.velocity.VelocityEngineUtils类刚刚被弃用,但事实上它已被完全删除。 也许我只是错了,我想知道VelocityEngineUtils类是否仍然存在于某个地方或者如果没有,我可以使用的替代类是什么。 编辑:似乎整个速度包已从Spring 3.2删除,所以现在甚至org.springframework.ui.velocity.VelocityEngineFactoryBean都不存在。 spring是否会离开Velocity?

如何配置spring来执行重叠的fixedRate任务?

我正在尝试使用java spring中的@Scheduled注释以固定速率执行任务。 但是,默认情况下,如果任务比速率慢,spring将不会以固定速率执行fixedRate任务。 是否有一些设置我可以添加到我的弹簧配置来改变这种行为? 例子 : @Service public class MyTask{ @Scheduled(fixedRate = 1000) public void doIt(){ // this sometimes takes >1000ms, in which case the next execution is late … } } 我有一个解决方案 ,但似乎不太理想。 基本上,我只是用线程池替换默认的单线程执行器,然后我有一个调度方法调用异步方法,因为@Async注释允许并发执行: @Service public class MyTask{ @Async public void doIt(){ // this sometimes takes >1000ms, but the next execution is on time […]

为什么在Spring 4.3中不推荐使用Velocity支持?

我们如何在Spring 5.0之后使用Velocity和Spring?

spring MVC:form:radiobutton for Boolean property

我只是想知道如何在Spring mvc表单中使用布尔值。 我尝试使用此代码: 我的jsp: pojo的财产: private Boolean dateInterval = false; 但我的dateInterval属性始终为null!

Spring Batch Multiple Threads

我正在写一个Spring Batch,想要在需要时扩展它。 我的ApplicationContext看起来像这样 @Configuration @EnableBatchProcessing @EnableTransactionManagement @ComponentScan(basePackages = “in.springbatch”) @PropertySource(value = {“classpath:springbatch.properties”}) public class ApplicationConfig { @Autowired Environment environment; @Autowired private JobBuilderFactory jobs; @Autowired private StepBuilderFactory stepBuilderFactory; @Bean public Job job() throws Exception { return jobs.get(“spring_batch”) .flow(step()).end() .build(); } @Bean(name = “dataSource”, destroyMethod = “close”) public DataSource dataSource() { BasicDataSource basicDataSource = new BasicDataSource(); return […]

Acegi / Spring安全性是否支持getUserPrincipal()?

我需要使用Acegi / Spring安全性连接现有应用程序。 为了开始,我正在寻找一个简单的信息:在这个上下文中,从我的应用程序调用的HttpServletRequest.getUserPrincipal()是否正确返回通过Spring获得的用户名(而不是使用特定于Spring的对象)? 我在Google上搜索了相互矛盾的信息。 我假设如果使用filter实现Acegi,它可以重载Servlet API的getUserPrincipal(),对吗? 附属问题:如果默认不是这种情况,有没有办法打开它? 谢谢, -Erik

有人可以解释一下Spring Security BasePermission.Create吗?

我正在开发一个涉及Spring Security ACL的项目,我遇到了创建权限BasePermission.CREATE 。 有人请解释这应该如何工作或它允许某人做什么? 我的理解是每个对象都有一个acl,每个acl都有很多ace,每个ace都有一个sid和一个权限。 如果必须创建一个对象来创建它,您如何授予对象创建它的权限?

Spring Security如何在跨Web应用程序请求的线程中管理SecurityContext?

在SpringSecurity中,它有一个类名SecurityContextHolder及其规范:’将给定的SecurityContext与当前执行线程关联。’ 使用Web应用程序每当请求到达服务器时,Spring还重新加载并在SecurityContextHolder中为其线程设置该请求的SecurityContext?