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 messages in different languages to different locale request users. For example. display English text to US users and Chinese text to china users. This article will show you how to achieve this in Spring.
Spring event architecture makes event publication and receives so easy. You can just configure the event publisher and listener object as Spring beans in the application context XML file. And then use them to send and receive events in your java code. This method decoupled the java event object relationships if you hardcode them in …
When your Spring project becomes bigger and bigger, the Spring bean configuration file may become very large. So you have to split it into several sub bean configuration files, each one includes a special group of beans definitions. But how to load them in your java code, this article will show you methods.
Spring tag util:constant can be used to declare a bean that references one class’s final static field. This article will show you how to do that.
Spring framework provides 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, or a file that is saved in the ClassPath. This article will show you examples of how to do that.
Spring FactoryBean is a special bean in the 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 objects, 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.