View RSS Feed

XML

Spring and XML

  1. Resource Representation in Spring

    by , 11-28-2011 at 01:05 AM
    In my previous tips, I looked out how to make the key RESTful method calls. In all of them the controllerís handler method finishes, and a logical view name is usually returned. In the case that the method doesnít return a logical view name (a method returning void) then the logical view name is derived from the requestís URL. The DispatcherServlet passes the view name to a view resolver in order to facilitate the determination of which view should render the results of the request.

    ...

    Updated 11-30-2011 at 01:42 PM by Spring Framework

    Categories
    Configuration , View , XML , REST , Resource
  2. Configuring Transactions in XML with Spring

    by , 11-27-2011 at 10:33 PM
    Continuing from my previous post, I will demonstrate how you can declare transactions in XML using Spring. Continuing from the previous tips on transaction attributes, letís dive straight in. Spring has a tx configuration namespace to simply declaring transactions in Spring. It is recommended that you include the aop namespace as well since some of the declarative transaction configuration elements use AOP configuration elements. The following shows how <tx:advice> is used for the Car service. ...

    Updated 11-27-2011 at 10:36 PM by Spring Framework

    Categories
    Configuration , Transaction , XML , Spring 3
    Attached Thumbnails Attached Images  
  3. Wiring Bean Post Processor in Spring

    by , 11-16-2011 at 04:32 PM
    In the last post, we create a class AnsiConvertor that implements the BeanPostProcessor interface. Now if we want to use this class in our application is running within a bean factory, we need to programmatically register the BeanPostProcessor using the factoryís addBeanPostProcessor() method:

    Java Code:
    BeanPostProcessor convertAnsi = new ConvertAnsi(); 
    factory.addBeanPostProcessor(convertAnsi);
    Or if you decide to use an application context, youíll need to register the ...
    Categories
    Configuration , XML , Bean
  4. How to Write a BeanPostProcessing in Spring

    by , 11-16-2011 at 04:28 PM
    In the previous tip we talked about special beans in Spring. One of the Springís special beans that I had mentioned was using the BeanPostProcessor interface in order to cut into the beanís life cycle and review or alter its configuration. In this tip, I will show you how to wire one. As mentioned in the previous tip I mentioned that the BeanPostProcessor provides two methods to alter the bean after it has been created and wired:

    Java Code:
    Object postProcessBeforeInitialization(Object bean,
    ...
  5. Spring's Special Beans

    by , 11-16-2011 at 04:25 PM
    The majority of beans in Spring are configured by the Spring container and made available for use in the application. Apart from these standard beans, Spring also has groups of beans that each serve a special purpose. The way in which Spring identifies these beans is because these beans have implemented certain interfaces that Spring considers special. The use of these interfaces allows these beans to do the following:
    • Post processing bean configuration in order to be involved in the bean
    ...
    Categories
    Bean , Configuration , XML
  6. How to Autowire a Spring Bean

    by , 11-16-2011 at 04:23 PM
    In previous tips, we have shown how to wire beanís properties using the <property> element. There is an alternative approach that can be used. Itís called autowiring. In this approach, Spring will wire your beans automatically if you set the autowire property on each <bean> on each of the beans that you want to autowire. There are four types of autowiring that Spring uses:

    • byNameóSpring will attempt to find a bean in the container whose name (or ID) is the same as the
    ...
  7. Wiring Sets, Maps and Properties in Spring

    by , 11-16-2011 at 04:19 PM
    Similarly to lists, there are times when you will need to map to other types of collections. In this tip, I will outline what you need to do to wire sets, maps and properties. The key to remember is that you want to wire your bean to the same type that is being used in the class definition. So if your bean has a java.util.Set property to guarantee uniqueness in the collection, you want to use the same definition in the xml definition.

    So for example, if you want to use a java.util.Set, ...