View RSS Feed

Recent Blogs Posts

  1. Configuring Web Security in Spring

    by , 11-27-2011 at 11:49 PM
    In a previous tip, I showed how to add in the necessary servlet filters in your Spring application file. We added both the Delegating FilterProxy along with the another filter, FilterChainProxy. In general, Spring security will automatically create these beans for you when you configure the <http> element.

    Java Code:
        <form-login />
        <http-basic />
        <logout /> 
        <intercept-url pattern="/**" access="ROLE_USER"
  2. Setting up Secure Web Requests in Spring

    by , 11-27-2011 at 11:48 PM
    Continuing our investigation of Spring Security, in this tip I will look at making secure web requests. All activities that starts in a java web application is initiated via an HttpServletRequests. As such, this is where the security of your application will start. This security takes the form of request-level security. This involves declaring one or more URL patterns as requiring some level of granted authority and restricting access to those without authority from accessing the content of those ...
  3. Configuring Spring Security

    by , 11-27-2011 at 11:45 PM
    In the last tip, I introduced Spring Security and outlined the modules that are available. In this tip, we will look at configuring namespaces. Using Spring, the nice thing about Spring Security is that all the security elements are configured as beans in the application context. It is not uncommon to have a Acegi configuration containing dozens of bean declarations that span multiple pages.

    Another nice feature is that Spring Security has its own security-specific namespace to simplify ...
  4. Configuring Transactions in XML with Spring

    by , 11-27-2011 at 11: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 11:36 PM by Spring Framework

    Configuration , Transaction , XML , Spring 3
    Attached Thumbnails Attached Images  
  5. How to Autowire a Spring Bean

    by , 11-16-2011 at 05: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
  6. Working with Spring's Bean Factories

    by , 11-16-2011 at 01:18 PM
    BeanFactory serves as the core to Spring's Dependency Injection implementation. A BeanFactory is responsible for managing components and their dependencies. Bean is the term used in Spring to refer to any component managed by the container. Typically all Spring beans adhere, at some level, to the JavaBeans specification, although it is not required. The most obvious case of Spring deviating from the JavaBean specification is with the use of Constructor Injection to wire your beans together. ...
  7. Using Constructor Injection with Spring

    by , 11-15-2011 at 03:09 PM
    As we had mentioned in a previous tip, Inversion of Control (IoC) can be divided into two subtypes. There is Dependency Lookup which has two types, Contextualized Dependency Lookup and Dependency Pull); and Dependency Injection which also has two types, Constructor Injection and Setter Injection. In this tip we will look at Constructor Dependency Injection. Constructor Dependency Injection is Dependency Injection where a component's dependencies are provided to it in its constructor(s). The component ...

    Updated 11-30-2011 at 12:43 PM by Spring Framework

    Dependency Injection
  8. Using Setter Injection in Spring

    by , 11-15-2011 at 03:02 PM
    An object is created in the Spring IOC container by invoking the zero-argument constructor. In this Setter Dependency Injection, the IoC container injects a component's dependencies into the component via JavaBean-style setter methods. A component's setters expose the set of the dependencies the IoC container can manage The dependent object is then passed as a parameter to the setter method. The CarService object needs data access objects (DAO) to execute data- base operations. The data access ...

    Updated 11-15-2011 at 03:10 PM by Spring Framework (Error in constructor for class)

    Dependency Injection , Bean , Configuration