DEV Community

Cover image for Twitter, SMS Services: Spring Boot possible XML Configuration

Posted on

Twitter, SMS Services: Spring Boot possible XML Configuration

The system configuration is important building real project and interoperable dependency injection. This article we will quickly discuss how to develop a simple Spring boot 2 application using XML based Spring configuration. Indeed, Twitter, SMS, Email systems are proceeding in Java Spring implementation and using XML. Indeed, as usual open source in the github, just use it.

In this example, we don't use either Annotation-based configuration or Java-based configuration, we only use XML based configuration to create and configure beans.
Spring provides a @ImportResource annotation is used to load beans from an applicationContext.xml file into an Application Context.


we are creating a simple message processing spring boot application. Here we are sending a message using different services like SMSService, TwitterService, and EmailService. We will configure message service beans in applicationContext.xml file and we will load beans using @ImportResource annotation as (see more source explanation github). Figure -1. XML configuration in Spring Boot.

Alt Text
Figure-1. XML Configuration in Spring Boot

The applicationContext.xml File

There is simplify source code in applicationContext.xml file:
> * Source code

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns=""
      <bean id ="emailService"
      class="spring.configure.service.EmailService" />
      <bean id="sMSService"
      class="spring.configure.service.SmsService" />
      <bean id="twitterService"
      class="spring.configure.service.TwitterService" />
      <bean id="messageProcessor"
      <property name="messageService" ref="twitterService"></property>

The essential point is you may update inside XML source code <bean id ="emailService". in your main folder address and work-space.

Top comments (0)