end-user
end-user

Reputation: 2947

Can I autowire (and autodiscover) daos while specifying the entities through a hibernate config?

Basically, I have objects that need to become entities, but the code is generated and I can't touch it (thus I can't use annotations). I'd like to list them in an xml config. However, I'd also like spring to autodiscover and autowire the respective daos. How would I go about setting up my configuration?

Upvotes: 1

Views: 170

Answers (1)

Ralph
Ralph

Reputation: 120831

You can configure the component scan how you like (btw: you can have several component scans)

<context:component-scan base-package="org.example" use-default-filters="false">
    <context:include-filter type="regex" expression=".*Dao"/>
</context:component-scan>

This example will create beans for all classes thet match the regex and are located within the base package.

@See Spring Reference Chapter 3.10.3 Using filters to customize scanning

Upvotes: 2

Related Questions