membersound
membersound

Reputation: 86865

Generic Spring services from external library?

I'd like to define some commonly used or generic service classes that should be used/shared by different projects. These common services should already make use of @Transactional, @Autowired and other Spring related stuff. So, I somehow have to define a spring context for these services to work.

Is it possible to put these services in a single external jar library that can then be used/imported by other (child)-projects? How could I create such a "personal framework"?

Upvotes: 0

Views: 259

Answers (1)

geoand
geoand

Reputation: 64059

What you could do is create a maven (or gradle) module that contains the code you desire to be reusable and also have a spring configuration (either XML or Java Config) that will be imported by the project that uses the module (either with or having component scanning pick up the @Configuration class of the module).

Upvotes: 1

Related Questions