Tag: spring

Spring autowire values in @Controller

The Java Spring framework allows you to annotate classes via the _@Controller _annotation. This allows you to maps requests and handle them via a MVC implementation. These classes can be detected automatically via a:

<context:component-scan base-package="example.class" />

The downside of this approach is that the values cannot be set anymore via a tag, because the class is already constructed. In order to still be able to set values in the class use the @Value annotation in the attribute fields of the class.

Leave a Comment