spring mvc archetype

关注微信公众号:
huyouxiao.com
回复语言名称,比如java,python,go,C, C++.有海量资源免费赠送!
mvn archetype:generate
-DarchetypeGroupId=pl.codeleak
-DarchetypeArtifactId=spring-mvc-quickstart
-DarchetypeVersion=5.0.0
-DgroupId=my.groupid
-DartifactId=my-artifactId
-Dversion=version
-DarchetypeRepository=http://kolorobot.github.io/spring-mvc-quickstart-archetype

Create a new project in IntelliJ

Create new project File > New > Project
Click Maven on the left hand side of the new project dialog
Check Create from archetype
Click the Add Archetype button
Set Group Id to pl.codeleak
Set Artifact Id to spring-mvc-quickstart
Set Version to 5.0.0
Set Repository to http://kolorobot.github.io/spring-mvc-quickstart-archetype
Click next and create the project

Note: If you would like to create a project using archetype published in your local repository, skip repository field and make sure it is installed locally (see below).
Creating a new project in Spring Tool Suite

Create new project File > New > Maven Project
Make sure Create a simple project option is not selected
Click Next to navigate to Select an Archetype screen
Make sure Include snapshot archetypes is selected
Click Add Archetype button
Set Archetype Group Id to pl.codeleak
Set Archetype Artifact Id to spring-mvc-quickstart
Set Archetype Version to 5.0.0
Set Repository URL to http://kolorobot.github.io/spring-mvc-quickstart-archetype
Click OK so the Archetype is added to the list
Click Next and fill in Group Id, Artifact Id and Version of your new project

Note: Remember so select Include snapshot archetypes.

If you have any troubles with installation in Eclipse, you may want to have a look at this issue: #74
Install archetype locally

To install the archetype in your local repository execute the following commands:

git clone https://github.com/kolorobot/spring-mvc-quickstart-archetype.git
cd spring-mvc-quickstart-archetype
mvn clean install

Create a project from a local repository

Create a new empty directory for your project and navigate into it and then run:

mvn archetype:generate \
    -DarchetypeGroupId=pl.codeleak \
    -DarchetypeArtifactId=spring-mvc-quickstart \
    -DarchetypeVersion=5.0.0 \
    -DgroupId=my.groupid \
    -DartifactId=my-artifactId \
    -Dversion=version

Note: The above command will bootstrap a project using the archetype published in your local repository.
Switching to PostgreSQL

Add dependency to PostgreSQL driver in POM:
org.postgresql postgresql 9.4.1207
Change persistence.properties:

dataSource.driverClassName=org.postgresql.Driver
dataSource.url=jdbc:postgresql:postgres
dataSource.username=postgres
dataSource.password=postgres

hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
hibernate.hbm2ddl.auto=create
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.use_sql_comments=true

Enabling MongoDB repositories

Open MongoConfig class and uncomment the following line:

// @EnableMongoRepositories(basePackageClasses = Application.class)

Now you can add repositories to your project:

@Repository
public interface MyRepository extends MongoRepository<MyDocument, String> {

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值