Tag: spring
-
How to set a default method to running code on the creation or destruction of a bean
In the post Executing code on the creation or destruction of a bean in Spring I explain three ways to execute code on the creation or destruction of a Bean in Spring. With two of these ways you can set the execution of a specific custom method: with the annotations @PostConstruct and @PreDestroy configuring the…
-
@Autowired and @Resource in Spring
The @Autowired annotation is used to configure the dependency injection in Spring and is associated with a setter method, or a field or a constructor of a class. In the case of a setter method or a field the bean used for dependency injection is chosen depending on the type.
-
PropertyEditors in Spring 3
PropertyEditor is an interface that provides a support for the conversion of the value of a property (usually of type String) in an object that can be Date, URL, etc.
-
Executing code on the creation or destruction of a bean in Spring
There are 3 ways to execute code to create a bean in Spring: with the annotation @PostConstruct implementing the interface InitializingBean configuring the property init-method The reason why you run code when you create a bean is often to check the dependencies, and assign a default value, or automated actions such as starting a scheduled…
-
Basic configuration of Spring Security 3 and MySQL
In this post I explain how to implement Spring Security in a web application, as I did in a previous post but the authenticated user’s username and password are not saved to a file .xml but in a MySQL database. As in the previous post, I configure one user only trying to access index.html and…
-
Basic configuration of Spring Security 3
In this post I write about a basic configuration of Spring Security 3, the Spring framework for authentication and authorization of the users. In this example there is only one user trying to access to index.html and he is redirected to the standard login page for authentication. In this project I use and configure maven…
-
Setting MyBatis in Spring
MyBatis, a free software distributed under the Apache License 2.0, helps to connect Spring with relational databases using XML or annotations.Here’s a simple example loading a jsp page to display data from a mysql table.
-
Basic configuration of Log4j in Spring using a .xml file
There are 2 ways to configure Log4j in Spring using: a .properties file a .xml file The configuration with the. xml file allows to take advantage of some aspects that can not be configured with the .properties file that is therefore regarded as obsolete. This article will explain how to configure Log4j using the .xml…
-
Basic configuration of Log4j in Spring using a .properties file
There are 2 ways to configure Log4j in Spring using: a .properties file a .xml file The configuration with the. xml file allows to take advantage of some aspects that can not be configured with the .properties file that is therefore regarded as obsolete. This article will explain how to configure Log4j using the .properties…