java - How to architect my project by maven -
thanks of read question!
months ago , had build nexus manage maven repository , build empty web project.
my goal create architecture company. when new project comes, can configure pom.xml
add frame dependency. well, project's frame springmvc
+velocity
+mybatis
i separated java source code 4 models, groupid
, artifectid
has been named below:
groupid __com.myproject.framework__
- parent pom's
artifactid
com.myproject.framework-root
. - sub models's
artifactid
framework-core
,framework-utils
, on.
this architecture can used when create empty java web project. configured pom.xml :
<dependency> <groupid>com.myproject.framework</groupid> <artifactid>framework-core</artifactid> <version>1.0</version> </dependency>
it's good, can reference jar package well!
but framework-core's java code uses spring framework. source code of myproject-framework-core
jar package, below:
action:
package com.hc360.buyer.action @controller public class activerecordaction extends baseaction { // ... }
service:
package com.hc360.buyer.service @service public class buyerinfomainserviceimpl{ ... }
this means must configure path spring config of new empty project, such as:
<context:component-scan base-package="com.hc360.buyer.service" /> <context:component-scan base-package="com.hc360.buyer.action" />
my question how can design framework models or jar package?
goal when create new java web project , reference myproject-framework-core
jar package, needn't have configure spring config below:
<context:component-scan base-package="com.hc360.buyer.action" />
in mind, best way need reference myproject-framework-core
jar package in new project's pom.xml, , works well.
Comments
Post a Comment