Great tutorial for adding Spring into the mix of my last post.
http://www.springbyexample.org/examples/simple-gwt-spring-webapp-reference.html
The tutorial doesn't cover everything though, make sure to take a look at the sample application
svn co http://svn.springbyexample.org/web/simple-gwt-webapp/tags/1.0/ simple-gwt-webapp
Showing posts with label Spring Framework. Show all posts
Showing posts with label Spring Framework. Show all posts
Friday, May 11, 2012
Thursday, February 16, 2012
Constants in Spring Context
Found an easy way to include a constant declared in some random Java file into the context file.
http://www.unicon.net/node/601
http://www.unicon.net/node/601
<bean id="Context" class="javax.naming.InitialContext">
<constructor-arg>
<util:map id="jmsProperties" map-class="java.util.Hashtable">
<entry>
<key><util:constant static-field="javax.naming.Context.INITIAL_CONTEXT_FACTORY"/></key>
<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
</entry>
<entry>
<key><util:constant static-field="javax.naming.Context.PROVIDER_URL"/></key>
<value>tcp://localhost:61616</value>
</entry>
</util:map>
</constructor-arg>
</bean>
Friday, August 19, 2011
Monday, May 9, 2011
Autowiring objects not instantiated by the Spring Framework
In order to enabled autowiring capabilities, add the following properties to the beans element.
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
xmlns:context="http://www.springframework.org/schema/context"
And make sure this line is included within the beans element
<context:annotation-config />
Next, in your code, get an instance of AutowireCapableBeanFactory.
Hint: Subclasses of AbstractApplicationContext have a getAutowireCapableBeanFactory, just one way to get such an instance.
Finally call the autowireBean(MyObject) method and like magic, so long as the annotations are correct, Spring will inject the correct instances.
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
xmlns:context="http://www.springframework.org/schema/context"
And make sure this line is included within the beans element
<context:annotation-config />
Next, in your code, get an instance of AutowireCapableBeanFactory.
Hint: Subclasses of AbstractApplicationContext have a getAutowireCapableBeanFactory, just one way to get such an instance.
Finally call the autowireBean(MyObject) method and like magic, so long as the annotations are correct, Spring will inject the correct instances.
Subscribe to:
Posts (Atom)