SpringSecurity3实战

版权声明:如需转载请注明出处,侵权必究!!! https://blog.csdn.net/mambaMentality/article/details/79952766
*1.为什么要学习SpringSecurity?
    *1.session窃取(固化攻击):解决方法登录前一个cookie信息 (sessionId),登录后改一个cookie(sessionId)
    *2.网站资源没有经过权限保护
*2.什么是SpringSecurity?
    Spring 基于Spring框架编写的(IOC核心功能,可以与spring进行无缝集成)
    Security 提高系统的安全性
    是一个开源的框架。
*3.关于SpringSecurity的版本
    社区比较活跃,版本升级比较的频繁。
    教学版本:spring security 3.1
*4编写Hello world体验SpringSecurity3.1作用
    *1.搭建开发环境
        jar包、配置文件、在web.xml中配置springsecurity
        web.xml中的配置
        <!-- 配置springsecurity session监听,主要实现session固化攻击防御和session并发控制 -->
        <listener>
            <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
        </listener>

        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    *2.测试 crm/index.jsp
        springsecurity内置一个登录页面
*5.细研SpringSecurity3.1
    *1.如何告诉springsecurity,正确的用户名和密码?
        *1.1.硬编码方式:
            <!-- 配置认证管理器 -->
            <security:authentication-manager alias="authenticationManager">
                <security:authentication-provider>
                    <!-- 通过硬编码的方式提供 -->
                    <security:user-service>
                        <security:user name="william" password="william" authorities="ROLE_MASTER22"/>
                    </security:user-service>
                </security:authentication-provider>
            </security:authentication-manager>

        缺点:
        在实际开发里面,不能使用.都要使用从数据库里面查询的方式
        authorities="ROLE_MASTER22"权限名,如果与访问资源所需要的权限名不同的话,页面将抛出403异常(权限被拒绝)

    *2.如何告诉springsecurity使用我们自定义的登录表单
        *1.springSecurity配置文件中:
        <!-- 配置登录页面 -->
        <!-- login-page:默认指定的登录页面. authentication-failure-url:出错后跳转页面. default-target-url:成功登陆后跳转页面.
            login-processing-url:发送的登录请求 -->
        <security:form-login default-target-url="/sys/loginAction.action"
            login-page="/login.jsp" authentication-failure-url="/prelogin.jsp"
            login-processing-url="/loginForSpringSecurity" />
         
        *2.把login.jsp <form action="loginForSpringSecurity">
        *3.把login.jsp <form action="loginForSpringSecurity">里面的用户名和密码的name属性值进行更改
            <input class="user_name" type="text" name="j_username" id="username" />
            <input class="user_pwd" type="password"  name='j_password' id="password" />
    
    *3.把springSecurity配置成企业级应用
        *1.执行原理
            *1.1.文字版
                1)容器启动(CustomFilterInvocationSecurityMetadataSourceImpl:loadResourceDefine加载系统资源与权限列表)
                2)用户发出请求
                3)过滤器拦截(CustomFilterSecurityInterceptorImpl:doFilter)
                4)取得请求资源所需权限(CustomFilterInvocationSecurityMetadataSourceImpl:getAttributes)
                5)匹配用户拥有权限和请求权限(CustomAccessDecisionManagerImpl:decide),如果用户没有相应的权限,
                执行第6步,否则执行第7步。
                6)登录
                7)验证并授权(CustomUserDetailsServiceImpl:loadUserByUsername)
                8)重复4,5
            *1.2.图形版
        *2.讲配置
            *1.从数据库里面,加载资源与角色的列表
                实现FilterInvocationSecurityMetadataSource接口
            *2.用户的请求,如何给我们自定义的拦截器
                Filter
            *3.自定义规则器(匹配访问该资源的权限与目前登录者所具有的权限 )
                *3.1.看看当前登录者身份信息(角色是什么)
                    自定义授权认证器:必须实现UserDetailsService接口
                    返回数据的dto必须实现 UserDetails接口    

                *3.2.根据请求资源的uri,从map里面加载访问该资源所应有的角色是什么
                *3.3.资源所应有的角色与当前登录者的角色进行比较
                    *1.情况一:如果该用户没有进行登录,跳转到登录页面去
                    *2.情况二:如果该用户已经进行登录,但没有访问该资源的权限,则抛出403异常
                    自定义的比较器,需要继续AccessDecisionManager类

            *4.配置SpringSecurity的md5加密类
                继承:BasePasswordEncoder
                让SpringSecurity自动调用


    *4.如何在Struts2里面拿到由SpringSecurity3.1.x验证后的用户信息?
        SysUserDTO result = (SysUserDTO)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
            












阅读更多

关于springsecurity3。07的配置问题

04-19

web.xmlrn[code=java]rnrn MySpringSecutityDemorn rn log4jConfigLocationrn classpath:log4j.propertiesrn rn rn log4jRefreshIntervalrn 60000rn rn rn contextConfigLocationrn rn classpath:com/masque/spring/applicationContext-*.xml,rn rn rn rn encodingFilterrn rn org.springframework.web.filter.CharacterEncodingFilterrn rn rn encodingrn UTF-8rn rn rn rn encodingFilterrn /*rn rn rn hibernateOpenSessionInViewFilterrn rn com.rstco.frame.modules.orm.hibernate.OpenSessionInViewFilterrn rn rn excludeSuffixsrn js,css,jpg,gifrn rn rn rn hibernateOpenSessionInViewFilterrn /*rn rn rn springSecurityFilterChainrn org.springframework.web.filter.DelegatingFilterProxyrn rn rn springSecurityFilterChainrn /*rn rn rn struts2Filterrn rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterrn rn rn rn struts2Filterrn /*rn rn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn rn rn org.springframework.web.util.Log4jConfigListenerrn rn rn rn rn org.springframework.web.util.IntrospectorCleanupListenerrn rn rn rn rn org.springframework.security.web.session.HttpSessionEventPublisher rn rn rn rn 20rn rn rn index.jsprn rn rn java.lang.Throwablern /common/500.jsprn rn rn 500rn /common/500.jsprn rn rn 404rn /common/404.jsprn rn rn 403rn /common/403.jsprn rn rn rn rarrn application/rarrn rn[/code]rnrnapplicationContext-security.xmlrn[code=java]rnrnrn rn SpringSecurity安全配置rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rnrn[/code]rn

SpringSecurity3 与 Extjs遇到的问题

02-20

最近学习SpringSecurity3搭建了一个开发框架,应用的技术有Spring,Spring MVC,Spring Security,myBatis,FreeMarker。rn在做登录实现的时候Extjs前端报错:[img=http://img.my.csdn.net/uploads/201302/20/1361339228_1965.png][/img]rn从错误信息来看,很明显错误原因是服务端返回了一个jsp页面,而不是json串导致。rn我的登录的思路是:login.jsp提交请求,验证通过的时候跳转至index.jsp页面。毕竟才疏学浅,先请教高人指点一下实现思路,和造成extjs报错的原因,小弟先谢谢各位了rnrnspring Security3配置文件:rn[code=text]rnrn rn SpringSecurity安全配置rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rnrnlogin.jsrn[code=javascript]rnExt.onReady(function()rn Ext.QuickTips.init();rn var login = new Ext.FormPanel(rn labelWidth:80,rn url:'',rn frame:true,rn title:'河北联众电子ERP登录窗口',rn defaultType:'textfield',rn width:300,rn height:150,rn monitorValid:true,rn rn items:[rn fieldLabel:'用户名',rn name:'j_username',rn allowBlank:falsern ,rn fieldLabel:'密码',rn name:'j_password',rn inputType:'password',rn allowBlank:falsern ],rn buttons:[rn text:'登录',rn formBind: true,rn handler:function()rn login.getForm().submit(rn waitTitle:"请稍后",rn waitMsg:'正在登录...',rn method:'POST', rn url:'j_spring_security_check',rn success:function()rn rn ,rn failure:function(form, action)rn if(action.failureType == 'server')rn obj = Ext.util.JSON.decode(action.response.responseText);rn Ext.Msg.alert('Login Failed!', obj.errors.reason);rn elsern Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);rn rn //login.getForm().reset();rn rn );rn rn ]rn );rn login.render('login');rn);rnrn[/code]rnrnlogin.jsp:rn[code=html]rnrnrn<#include "common/meta.html"/>rn rn rn Insert title herernrnrn rnrn[/code]rnrnindex.jsp:rn[code=html]rnrnrnrn<#include "common/meta.html"/>rn rn rn 登录rn rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn 个人设置 注销rn rn rn rn rn rn rnrnrn[/code]rn

SpringSecurity3 扩展UserDetails建表错误

02-17

@Entityrn@Table(name="appuser")rnpublic class AppUser implements UserDetailsrn rn private static final long serialVersionUID = 1L;rn protected int userID;rn private String username;rn private String password;rn private Set roles;rn rnrn public void setUserID(int userID) rn this.userID = userID;rn rn rn @Idrn @GeneratedValuern public int getUserID() rn return userID;rn rnrn public void setUsername(String username) rn this.username = username;rn rnrn public String getUsername() rn return username;rn rnrn public void setPassword(String password) rn this.password = password;rn rnrn public String getPassword() rn return password;rn rnrnrn public boolean isAccountNonExpired() rn return true;rn rnrn public boolean isAccountNonLocked() rn return true;rn rnrn public boolean isCredentialsNonExpired() rn return true;rn rnrn public boolean isEnabled() rn return true;rn rnrn public Collection getAuthorities() rn /*List rights = new ArrayList();rn rights.add(new GrantedAuthorityImpl("ROLE_USER"));rn return rights;*/rn if(roles==null)rn List rights = new ArrayList();rn return rights;rn elsern List rights = new ArrayList(roles);rn return rights;rn rn rnrn public void setRoles(Set roles) rn this.roles = roles;rn rn @ManyToMany(rn cascade=CascadeType.PERSIST,CascadeType.MERGE,rn targetEntity=com.system.model.AppRole.class)rn @JoinTable(rn name="user_role",rn joinColumns=@JoinColumn(name="userID"),rn inverseJoinColumns=@JoinColumn(name="roleId"))rn public Set getRoles() rn return roles;rn rnrnrn另一个实体类为:;rnrn@Entityrn@Table(name="approle")rnpublic class AppRole implements GrantedAuthorityrn private static final long serialVersionUID = 1L;rn rn private int roleId;rn private String roleName;rn private Set users;rn rn public String getAuthority() rn return roleName;rn rnrn public void setRoleId(int roleId) rn this.roleId = roleId;rn rn rn @Idrn @GeneratedValuern public int getRoleId() rn return roleId;rn rnrn public void setRoleName(String roleName) rn this.roleName = roleName;rn rnrn public String getRoleName() rn return roleName;rn rnrn public void setUsers(Set users) rn this.users = users;rn rn rn @ManyToMany(rn cascade=CascadeType.PERSIST,CascadeType.MERGE,rn mappedBy="roles",rn targetEntity=com.system.model.AppUser.class)rn public Set getUsers() rn return users;rn rnrnrn但是运行时出现如下异常:rnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [conf/app-resources.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [conf/app-resources.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.Collection, at table: appuser, for columns: [org.hibernate.mapping.Column(authorities)]rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:435)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)rn at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:156)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)rn ... 24 morernCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [conf/app-resources.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.Collection, at table: appuser, for columns: [org.hibernate.mapping.Column(authorities)]rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)rn ... 39 morernCaused by: org.hibernate.MappingException: Could not determine type for: java.util.Collection, at table: appuser, for columns: [org.hibernate.mapping.Column(authorities)]rn at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:291)rn at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:275)rn at org.hibernate.mapping.Property.isValid(Property.java:217)rn at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464)rn at org.hibernate.mapping.RootClass.validate(RootClass.java:236)rn at org.hibernate.cfg.Configuration.validate(Configuration.java:1193)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1378)rn at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)rn at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)rn at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)rn at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)rn ... 46 morern

springSecurity3配置启动后报错

07-18

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.authentication.AuthenticationManagerFactoryBean] while setting bean property 'parent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userDetailsServiceImpl' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.persistence.impl.UserDaoImpl com.security.BdUserService.userDaoImpl; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.persistence.impl.UserDaoImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:125)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)rn at org.apache.catalina.core.StandardService.start(StandardService.java:525)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:595)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userDetailsServiceImpl' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.persistence.impl.UserDaoImpl com.security.BdUserService.userDaoImpl; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.persistence.impl.UserDaoImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)rn at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:274)rn ... 39 more

没有更多推荐了,返回首页