You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by minigold <km...@gmail.com> on 2013/06/17 10:25:00 UTC
Spring @Autowired annotation is not working anymore after use shiro
Annotation (@RequiresAuthentication) over the method
Hello,
In my struts2 Action Class I inject Spring service. And I want to apply
shiro security checking over the method . So I use @RequiresAuthentication
over the method. After that I can't get the value of service injected by
string annotaion(@Autowired). It becomes null.
I referenced the shiro documentation for spring integration.
So my question is shiro annotation can use together with srping annotation
in struts2 action class?
--
View this message in context: http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849.html
Sent from the Shiro User mailing list archive at Nabble.com.
Re: Spring @Autowired annotation is not working anymore after use shiro Annotation (@RequiresAuthentication) over the method
Posted by Richard Adams <ri...@researchspace.com>.
Could you perhaps post a code sample of how you're using the
annotations?
On 18 Jun 2013, at 15:00, minigold wrote:
> Thank you for your advice.
> Yes. I added those lines to my applicationContext.xml file. Shiro
> annotations are working but spring service annotations are not working
> anymore.
>
>
> On Tue, Jun 18, 2013 at 3:59 PM, otter606 [via Shiro User] <
> ml-node+s582556n7578850h78@n2.nabble.com> wrote:
>
>> Hi,
>> I'm not a struts user but have you added these lines to your
>> security.xml
>> Spring configuration file?
>> <bean id="lifecycleBeanPostProcessor"
>> class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
>>
>>
>>
>>
>> <bean
>> class
>> =
>> "org
>> .springframework
>> .aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
>> depends-on="lifecycleBeanPostProcessor"/>
>> <bean id="securityManager"
>> class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
>>
>> </bean>
>> <bean
>> class
>> =
>> "org
>> .apache
>> .shiro
>> .spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
>> <property name="securityManager" ref="securityManager"/>
>> </bean>
>>
>> I don't know a lot of detail of what these postprocessors are or
>> how they
>> work, but they do enable Shiro annotations for us on service methods.
>>
>> Best wishes
>> Richard
>>
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion
>> below:
>>
>> http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849p7578850.html
>> To unsubscribe from Spring @Autowired annotation is not working
>> anymore
>> after use shiro Annotation (@RequiresAuthentication) over the
>> method, click
>> here<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7578849&code=a21vbmt5YXdAZ21haWwuY29tfDc1Nzg4NDl8NDg0MzYxOTg=
>> >
>> .
>> NAML<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> >
>>
>
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849p7578851.html
> Sent from the Shiro User mailing list archive at Nabble.com.
Richard Adams
richard@researchspace.com
Re: Spring @Autowired annotation is not working anymore after use shiro Annotation (@RequiresAuthentication) over the method
Posted by Richard Adams <ri...@researchspace.com>.
Could you perhaps post a code sample of how you're using the
annotations?
On 18 Jun 2013, at 15:00, minigold wrote:
> Thank you for your advice.
> Yes. I added those lines to my applicationContext.xml file. Shiro
> annotations are working but spring service annotations are not working
> anymore.
>
>
> On Tue, Jun 18, 2013 at 3:59 PM, otter606 [via Shiro User] <
> ml-node+s582556n7578850h78@n2.nabble.com> wrote:
>
>> Hi,
>> I'm not a struts user but have you added these lines to your
>> security.xml
>> Spring configuration file?
>> <bean id="lifecycleBeanPostProcessor"
>> class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
>>
>>
>>
>>
>> <bean
>> class
>> =
>> "org
>> .springframework
>> .aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
>> depends-on="lifecycleBeanPostProcessor"/>
>> <bean id="securityManager"
>> class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
>>
>> </bean>
>> <bean
>> class
>> =
>> "org
>> .apache
>> .shiro
>> .spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
>> <property name="securityManager" ref="securityManager"/>
>> </bean>
>>
>> I don't know a lot of detail of what these postprocessors are or
>> how they
>> work, but they do enable Shiro annotations for us on service methods.
>>
>> Best wishes
>> Richard
>>
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion
>> below:
>>
>> http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849p7578850.html
>> To unsubscribe from Spring @Autowired annotation is not working
>> anymore
>> after use shiro Annotation (@RequiresAuthentication) over the
>> method, click
>> here<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7578849&code=a21vbmt5YXdAZ21haWwuY29tfDc1Nzg4NDl8NDg0MzYxOTg=
>> >
>> .
>> NAML<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> >
>>
>
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849p7578851.html
> Sent from the Shiro User mailing list archive at Nabble.com.
Richard Adams
richard@researchspace.com
Re: Spring @Autowired annotation is not working anymore after use
shiro Annotation (@RequiresAuthentication) over the method
Posted by minigold <km...@gmail.com>.
Thank you for your advice.
Yes. I added those lines to my applicationContext.xml file. Shiro
annotations are working but spring service annotations are not working
anymore.
On Tue, Jun 18, 2013 at 3:59 PM, otter606 [via Shiro User] <
ml-node+s582556n7578850h78@n2.nabble.com> wrote:
> Hi,
> I'm not a struts user but have you added these lines to your security.xml
> Spring configuration file?
> <bean id="lifecycleBeanPostProcessor"
> class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
>
>
>
>
> <bean
> class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
> depends-on="lifecycleBeanPostProcessor"/>
> <bean id="securityManager"
> class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
>
> </bean>
> <bean
> class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
> <property name="securityManager" ref="securityManager"/>
> </bean>
>
> I don't know a lot of detail of what these postprocessors are or how they
> work, but they do enable Shiro annotations for us on service methods.
>
> Best wishes
> Richard
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849p7578850.html
> To unsubscribe from Spring @Autowired annotation is not working anymore
> after use shiro Annotation (@RequiresAuthentication) over the method, click
> here<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7578849&code=a21vbmt5YXdAZ21haWwuY29tfDc1Nzg4NDl8NDg0MzYxOTg=>
> .
> NAML<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849p7578851.html
Sent from the Shiro User mailing list archive at Nabble.com.
Re: Spring @Autowired annotation is not working anymore after use
shiro Annotation (@RequiresAuthentication) over the method
Posted by otter606 <ri...@researchspace.com>.
Hi,
I'm not a struts user but have you added these lines to your security.xml
Spring configuration file?
<bean id="lifecycleBeanPostProcessor"
class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
depends-on="lifecycleBeanPostProcessor"/>
<bean id="securityManager"
class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
</bean>
<bean
class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
<property name="securityManager" ref="securityManager"/>
</bean>
I don't know a lot of detail of what these postprocessors are or how they
work, but they do enable Shiro annotations for us on service methods.
Best wishes
Richard
--
View this message in context: http://shiro-user.582556.n2.nabble.com/Spring-Autowired-annotation-is-not-working-anymore-after-use-shiro-Annotation-RequiresAuthenticationd-tp7578849p7578850.html
Sent from the Shiro User mailing list archive at Nabble.com.