Error creating bean with name ‘authenticationSuccessServlet’: Scope ‘request’ is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton;
情景:
我自定义了一个spring security中的AuthenticationSuccessHandle类
并在spring security中配置authentication-success-handler-ref
目的是在spring security认证完用户了之后调用自定义的AuthenticationSuccessHandle类中的方法,我想在Session中存放认证用户的id
自定义的AuthenticationSuccessHandle类,我在spring中配置的scope是request
问题描述:
这个scope为request的bean不能被当前线程调用,请将scope改成singleton
原因:
我在网上查到原因是,spring security需要在启动的时候就加载AuthenticationSuccessHandle类,然而spring只在有请求的时候才加载这个类,所以spring security就加载不到
解决方案:
将这个bean的scope改成singleton
<script type="text/javascript">
$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('<ul/>').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i <= lines; i++) {
$numbering.append($('<li/>').text(i));
};
$numbering.fadeIn(1700);
});
});
</script>
分享到:
相关推荐
1.4 当 Scope="singleton" 且 lazy-init="true" 时 1.5 当scope="prototype"时 1.6 当scope="prototype" 且 lazy-init="true" 时 1.7 小结 1.8 depends-on 1.8.0 实体类JavaBean 1.8.0.1 Student类 1.8.1 配置文件都...
<th scope="col" <th scope="col" <th scope="col" <th scope="col" <th scope="col" <th scope="col" <th scope="col" </tr> <td class="td_button" 38px" valign="middle" align="left" ...
spring bean 的作用域(scope), SPringle bean的作用域
在 Element UI Table ...<template slot-scope=scope> <el type=scope.row.tag>{{scope.row.tag}} 这里首先利用 slot-scope 属性(Vue 2.6.0 已废弃)将子组件的数据(row.tag)传递给了父组件。 利用三元表达式为
A.<s:property value=”{’Jack’,’Rose’,’Andy’}” scope=“request”/> B.<s:property set=”{‘Jack’,’Rose’,’Andy’}” scope=”request”/> C.<s:set var=”names” value=”{‘Jack’,’Rose’,’Andy...
scope="request" type="com.yourcompany.struts.action.TestAction" /> attribute="test1Form" input="/test1.jsp" name="test1Form" path="/test1" scope="request" type=...
首先定义一个简单的类 import lombok.Getter; import lombok.Setter; @Getter @Setter public class HelloMessageGenerator { private String message;... return getClass().getSimpleName() + "@" + Integer....
例如:定义一个bean: <bean:define id=”test” value=”this is a test”/> 源bean在页作用域中被拷贝大哦请求作用域中的另一个bean: <bean:define id=”targetBean” name=”...scope=”page” toScope=”request”/>
Spring In Action-3.2@Scope单例、多例Bean,Spring In Action-3.2@Scope单例、多例Bean,Spring In Action-3.2@Scope单例、多例Bean,Spring In Action-3.2@Scope单例、多例Bean
例如: <bean id="scope" class="com.itheima.scope.Scope" scope="singleton"/> 在Spring中如何配置singleton作用域? 在Spring配置文件中,同样使用<bean>元素的scope属性,将Bean的作用域定义成prototype 。 ...
<bean scope=“singleton"></bean> 取值: singleton:设定创建出的对象保存在spring容器中,是一个单例的对象(bean默认是单例) 单例的对象是在加载spring容器时就创建了,且此后你在同一个bean获取资源时,用...
创建SpringBean配置工具类(安全)如: <bean id=... scope="prototype"></bean>
<jsp:useBean id="query" class="Bean.QueryBean" scope="session"> <jsp:setProperty name="query" property="*"/> request.setCharacterEncoding("UTF-8"); String name=request.getParameter("username"); ...
李兴华java web开发实战经典课程源代码 rwquest
C#获取支付宝用户信息,... var url = string.Format("https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id={0}&scope=auth_user&redirect_uri={1}", appid, ENCODED_URL); Response.Redirect(url); }
我的博客中“maven环境搭建及Spring入门”的...* 单例 scope=“singleton” * 原型 scope=“prototype” 5。bean的生命周期: 默认情况下IOC容器创建的时候就会自动创建所有对象,只支持懒加载。default-lazy-init=true
scope="request" --作用域 type="com.lmf118.struts.action.AddAction"> <forward name="result" path="/result.jsp" /> <message-resources parameter="com.lmf118.struts.ApplicationResources" /> ...
<c:if test="testCondition" var="varName" [scope="{page|request|session|application}"]/> 语法2:有本体内容 <c:if test="testCondition" [var="varName"] [scope="{page|request|session|application}"]>...
写在前面 vue中关于插槽的文档说明很短,语言又写的很凝练,再加上其和methods,data,computed等常用选项使用频率、使用先后上的差别,这就有可能造成初次接触插槽的开发者容易产生“算了吧,回头再学,反正已经...
<bean name="/searchEmployee" scope="prototype" class="com.mysteelsoft.action.EmployeeAction"> <property name="employeeDao" ref="employeeDao"/> </bean> <bean name="/addEmployee" scope=...