OK, here it is:
and a couple of Java classes:Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:annotation-config/> <bean id="dao" class="example.Dao"/> <!-- dao is autowired into service, but maxClients isn't --> <bean id="service" class="example.Service" p:maxClients="2000"/> </beans>
Code:package example; public class Dao { }When I load up the context I get the following on the console:Code:package example; import org.springframework.beans.factory.annotation.Autowired; public class Service { private Dao dao; private int maxClients; @Autowired public void setDao(Dao dao) { System.out.println("Setting dao=" + dao); this.dao = dao; } public void setMaxClients(int maxClients) { System.out.println("Setting maxClients=" + maxClients); this.maxClients = maxClients; } }
Hope that addresses what you're trying to do.Code:INFO DispatcherServlet - FrameworkServlet 'contact': initialization started INFO XmlWebApplicationContext - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@3ef810: display name [WebApplicationContext for namespace 'contact-servlet']; startup date [Wed Jul 09 02:42:32 MST 2008]; root of context hierarchy INFO XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/contact/beans-servlet.xml] INFO XmlWebApplicationContext - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@3ef810]: org.springframework.beans.factory.support.DefaultListableBeanFactory@11c2b67 INFO DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@11c2b67: defining beans [org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,dao,service]; root of factory hierarchy Setting dao=example.Dao@c5e9c Setting maxClients=2000 INFO DispatcherServlet - FrameworkServlet 'contact': initialization completed in 891 ms


Reply With Quote
