Besides define Spring beans in a configuration file, Spring also provides some java annotation interface for you to make Spring bean declaration simple and easy. These interfaces are also called stereotype annotation. They are @Component, @Repository, @Service, and @Controller. If you want to reference such a bean, you just need to annotate that field with …
Spring framework support internationalization. With this function, you can display text message in different languages to different locale request user. For example. display English text to US user and Chinese text to china user. This article will show you how to achieve this in Spring.
Spring event architecture make event publish and receive so easy. You can just configure event publisher and listener object as Spring beans in application context xml file. And then use them to send and receive event in your java code. This method decoupled java event object relationship if you hardcode them in java application. This …
When your Spring project becomes bigger and bigger, the Spring bean configuration file may become very large. So you have to split it to several sub bean configuration file, each one include a special group of beans definition. But how to load them in your java code, this article will show you methods.
Spring util:constant tag can be used to declare a bean which reference one class’s final static field. This article will show you how to do that.
Spring framework provide methods to load external resource data (text file, image file, binary file) into your application. The external resource can be a local file, a url locator file and the file saved in the ClassPath. This article will show you examples about how to do that.
Spring FactoryBean is a special beans in spring framework. It can be used as a bean factory to create other Spring managed beans. You may be already familiar with built-in FactoryBean such as JndiObjectFactoryBean which is used to lookup jndi object, LocalSessionFactoryBean which is used to create hibernate session object, but this article will tell …
This example will show you how to use constructor injection to autowire spring bean as another bean’s constructor parameters.
Spring framework provides three methods for you to customize bean behavior after bean initialization and before destruction. Of course, all the methods are invoked by the spring bean factory. This article will tell you how to do that by examples.
Besides declare spring bean dependencies in the bean configuration file, the spring framework provides the autowire function to make bean dependency declaration easily. There are below autowire modes, they are no-autowire, autowire by bean name, autowire by bean class type, autowire by constructor. This article will show you examples of autowire beans by name.