0

ZK + Spring + Injection

asked 2011-07-18 05:09:05 +0800

antigo gravatar image antigo
9

Hi,

my web-app makes use of GenericForwardComposer to populate my zuls.

I want to use spring (security) to protect methods of my services. As far as i understand the services have to be instantiated by the spring framwork to make the @Secured annotations etc. work.
I looked at the zkspring sample code and they all use Servlets, which are controlled by Spring. So there's no problem to autowire an instance of your service. This autowired instance is controlled by spring and the securiy annotations work just fine.

I managed to get Spring to instantiate my service by defining a bean in a xml file and get this bean with the SpringUtil.getBean(myService"); The security annotations work this way, but i'd rather have this services autowired.

Do any of you have an idea how to achieve this?

Thanks in advance,
Antigo

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-07-18 18:24:18 +0800

jsanchez gravatar image jsanchez
30 1

Can you provide example code of you Spring XML configuration and and how you intend or want to use it.

I've got Spring Security working with ZK but restricting it based on user role and URI path, but without annotations.

link publish delete flag offensive edit

answered 2011-07-19 01:45:53 +0800

antigo gravatar image antigo
9

I want to use security annotations in my service and domain-object layer. As i said the annotations do work if the instantiation is made by Spring.

I found this piece in the spring documentation: http://static.springsource.org/spring-security/site/docs/3.0.x/reference/secure-object-impls.html
It says "That's it! Now you can create your beans from anywhere within your application, using whatever means you think fit (eg new Person();) and they will have the security interceptor applied."

Sounds exactly like what i need. I just have to figure out how it works ^^

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-07-18 05:09:05 +0800

Seen: 264 times

Last updated: Jul 19 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More