Add Spring autowiring support to Clara add-on
The add-on is an extension to the [Clara addon] (https://vaadin.com/directory#!addon/clara). It adds autowiring support for nested components to it.
Clara4Spring depends on Clara (version > 1.4.0) and Spring framework, e.g
group, artifact, version org.vaadin.addons, clara, > 1.4.0 org.springframework, spring-core org.springframework, spring-context org.springframework, spring-beans org.slf4j, slf4j-api com.vaadin, vaadin-server, > 1.7
The dependencies are not included in the distribution, intentionally, to provide you with most freedom to define the dependencies in your project with the versions of your choice.
Clara syntax for autowire
Sample of autowiring by bean id (with autowired bean id='specificTestComponent'): <a:OtherTestComponent id="testComponent" xmlns:a="urn:autowired:byId:specificTestComponent" />
Sample of autowiring by bean type (with autowired bean type = 'org.vaadin.clara.spring.TestComponent'): <a:TestComponent id="testComponent" xmlns:a="urn:autowired:byType:org.vaadin.clara.spring" />
To allow Clara to autowire nested components it needs to be aware of the Spring application context. For this purpose the SpringClara class is introduced. SpringClara can be autowired itself when it is instantiated itself from a Spring container.
For further details of usage see sample autowired declarative UIs in the unit tests @ Github
Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.
- Apache License 2.0
- Vaadin 7.0+
- Browser Independent