Example: Spring property injection done in a strange way

I’m reviewing the possibilities of GroupDocs.Viewer for one of our customers.

We are integrating it with Spring MVC. In the examples as can be found here ‘http://groupdocs.com/docs/display/viewerjava/GroupDocs.Viewer+for+Java±+Integrating+with+Spring’, the @Property annotation from the spring-property-annotations library from urbanmania is used.

This seems a bit strange to me because Spring itself has the possibility to use the @Value annotation to provide the same solution. And you can even do it without using any XML configuration anymore in the following way:

@PropertySource(value = “groupdocs.properties”)
@Configuration
public class GroupDocsConfig implements IServiceConfiguration {

@Value(“${groupdocs.viewer.applicationPath}”)
protected String applicationPath;

@Value(“${groupdocs.viewer.filePath}”)
protected String basePath;


}


In my opinion it’s better to not introduce that many other frameworks in
this kind of examples, but stick to the basics as much as possible.

Hello there,

Thank you for this suggestion. The configuration that is implemented in the sample at the moment was left there for the backward compatibility (you can read more here https://github.com/rgladwell/spring-property-annotations). So it is runnable with Spring versions starting from 2.5.X. The purpose of the sample is not only the small size but also the demonstration of most common case implementations.