Hi,
I'm just getting up to speed with integrating Spring into a Struts 2 Web Application I'm developing. I've created an applicationContext.xml with two beans. When I try to deploy my web project, I am receiving the NotWritablePropertyException: Invalid property 'securityManager' of bean class [com.test.interceptor.LoginInterceptor]: Bean property 'securityManager' is not writable or
has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
My applicationContext.xml contains the following:
My code for my SecurityManager Interface is:HTML Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="loginInterceptor" singleton="true" class="com.test.interceptor.LoginInterceptor"> <property name="securityManager"><ref local="securityManager" /></property> </bean> <bean id="securityManager" singleton="true" class="com.test.security.impl.SecurityManagerImpl"/> </beans>
My SecurityManager Implementation looks like the following:Code:package com.test.security; public interface SecurityManager { public User login (String name, String pswd); }
I would really appreciate some advice as to what I seem to be missing in my configuration as I can't seem to find any obvious typos that would account for this?Code:package com.test.security.impl; import com.test.security.SecurityManager; import com.test.security.User; public class SecurityManagerImpl implements SecurityManager { private SecurityManagerImpl securityManager = null; public void setSecurityManager(SecurityManagerImpl securityManager) { this.securityManager = securityManager; } public User login(String name, String pswd) { //TODO: delegate to user lookup class to obtain user credentials return new User(){}; } }
Thanks in advance.


Reply With Quote