java - Divide Spring configuration across multiple projects -


we have quite few projects use same codebase (backend code). frontend tends different. decided best approach seperate backend , frontend different projects: engine , project_name

now these spring-projects. seem logical if divide spring configurations aswell: database.xml, services.xml belong project engine. , specific frontend.xml belong project_name. link these up, need generic springbeans.xml imports of these xml's.

i tried following directory structure:

engine project

  • config
    • spring
      • database.xml
      • services.xml

project_name project

  • config
    • springbeans.xml
    • spring
      • frontend.xml

the contents of springbeans.xml simply:

    <import resource="spring/database.xml"/>     <import resource="spring/services.xml"/>     <import resource="spring/frontend.xml"/>  

i set eclipse project_name project references engine project. when start it, springbeans.xml gets found, xml files in engine project aren't found (filenotfoundexception). i'll note before splitting engine , frontend code different projects, principle of importing other xml files worked charm.

so question you: possible make different spring configrations in different projects play nicely?

since spring bean configuration files in classpath, need add prefix claspath resource location:

<import resource="classpath:spring/database.xml"/> <import resource="classpath:spring/services.xml"/> <import resource="classpath:spring/frontend.xml"/> 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -