Course – LS – All
announcement - icon

Get started with Spring Boot and with core Spring, through the Learn Spring course:


1. Introduction

This quick tutorial will show how to build a simple RSS feed using Spring MVC and the AbstractRssFeedView class.

Afterward, we’ll also implement a simple REST API – to expose our feed over the wire.

2. RSS Feed

Before going into the implementation details, let’s make a quick review on what RSS is and how it works.

RSS is a type of web feed which easily allows a user to keep track of updates from a website. Furthermore, RSS feeds are based on an XML file which summarizes the content of a site. A news aggregator can then subscribe to one or more feeds and display the updates by regularly checking if the XML has changed.

3. Dependencies

First of all, since Spring’s RSS support is based on the ROME framework, we’ll need to add it as a dependency to our pom before we can actually use it:


For a guide to Rome have a look at our previous article.

4. Feed Implementation

Next up, we’re going to build the actual feed. In order to do that, we’ll extend the AbstractRssFeedView class and implement two of its methods.

The first one will receive a Channel object as input and will populate it with the feed’s metadata.

The other will return a list of items which represents the feed’s content:

public class RssFeedView extends AbstractRssFeedView {

    protected void buildFeedMetadata(Map<String, Object> model, 
      Channel feed, HttpServletRequest request) {
        feed.setTitle("Baeldung RSS Feed");
        feed.setDescription("Learn how to program in Java");

    protected List<Item> buildFeedItems(Map<String, Object> model, 
      HttpServletRequest request, HttpServletResponse response) {
        Item entryOne = new Item();
        entryOne.setTitle("JUnit 5 @Test Annotation");
        entryOne.setAuthor("[email protected]");
        return Arrays.asList(entryOne);

5. Exposing the Feed

Finally, we’re going to build a simple REST service to make our feed available on the web. The service will return the view object that we just created:

public class RssFeedController {

    private RssFeedView view;
    public View getFeed() {
        return view;

Also, since we’re using Spring Boot to start up our application, we’ll implement a simple launcher class:

public class RssFeedApplication {
    public static void main(final String[] args) {, args);

After running our application, when performing a request to our service we’ll see the following RSS Feed:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
        <title>Baeldung RSS Feed</title>
        <description>Learn how to program in Java</description>
            <title>JUnit 5 @Test Annotation</title>
            <pubDate>Tue, 19 Dec 2017 00:00:00 GMT</pubDate>
            <author>[email protected]</author>

6. Conclusion

This article went through how to build a simple RSS feed with Spring and ROME and make it available for the consumers by using a Web Service.

In our example, we used Spring Boot to start up our application. For more details on this topic, continue reading this introductory article on Spring Boot.

As always, all the code used is available over on GitHub.

Course – LS – All
announcement - icon

Get started with Spring Boot and with core Spring, through the Learn Spring course:


res – REST with Spring (eBook) (everywhere)