• 13 September

    Spring Security : Customize 403 access denied page

    In this post , we will see how to customize 403 access denied page. If user do not have access to page, then it will show default 403 page which will look like as below: You can customize 403 as below page: If you want to configure custom 403 access denied page, there are two […]

  • 12 September

    spring security database authentication example

    In previous post, we have already seen  how to use custom login page in Spring security. We have declared username and password in spring-security.xml but what if you want to read it from database. In most of the cases, we will read credentials from database. In this post, we will do authentication using database. We […]

  • 29 August

    Spring NamedParameterJdbcTemplate example

    In this post , we are going to see about Spring NamedParameterJdbcTemplate. In previous post, we have already seen Spring JdbcTemplate example. NamedParameterJdbcTemplate is used to pass named parameter instead of ? in case of JdbcTemplate. It makes code more readable and maintainable. Lets say you have 10 parameters and you have to use 10 ? […]

  • 28 August

    Spring JdbcTemplate example

    In this post, we are going to see Spring JdbcTemplate example. Spring jdbcTemplate is used to convenient way to connect to database and execute queries. It internally use JDBC code only, but provides you APIs , so you don’t have to write boiler plate code. You don’t have write much code before and after executing […]

  • 09 August

    Spring @Component, @Service, @Repository and @Controller annotations

    We have already seen @Autowired annotation but we have used xml configuration to configure beans and inject it to container but if you use  @Component, @Service, @Repository and @Controller annotations and enable component auto scan, spring will automatically import these bean into container and you don’t have to explicitly define them in xml file. So basically all […]

  • 27 July

    Prefix “context” for element “context:component-scan” or “context:annotation-config” is not bound : Spring error

    When you are working on spring or spring mvc application, you may encounter below error message. org.xml.sax.SAXParseException: The prefix “context” for element “context:component-scan” is not bound . or org.xml.sax.SAXParseException: The prefix “context” for element “context:annotation-config” is not bound . This issue generally occurs when you do not include context namespace. For example: Lets say you have below […]

  • 26 July

    How to load multiple Spring configuration files

    In this post , we will see how to load multiple spring bean configuration files. Sometimes, you have multiple spring bean configuration file , you may have different configuration file for service, different for business object. When you are working on complex application, it is not good practice to have only single xml configuration, you […]

  • 22 July

    Spring AOP AspectJ Annotation Example

    In this post, we will see Spring AOP AspectJ Annotation examples. If you are not familiar with Spring AOP terminology, you may go through Spring Aspect oriented programming(AOP) tutorial. Following are the AspectJ annotations which we are going to use to implement Spring AOP. @Aspect : To declare a class as Aspect. Annotations which are […]

  • 16 July

    Spring AOP tutorial

    This is 16 of 16 parts of tutorial series Tutorial Content: Spring tutorial for beginners Introduction to spring framework Spring interview questions Dependency injection(ioc) in spring Spring hello world example in eclipse Spring java based configuaration Dependency injection via setter method in spring Dependency injection via constructor in spring Spring Bean scopes with examples Initializing […]