Maven + CRUD + Spring + Hibernate + MySQL/Sql Server 2008
来源:互联网 发布:手机热血传奇挂机软件 编辑:程序博客网 时间:2024/05/21 19:39
Tips:
Create a dynamic web project; To replace the default src folder to src\java\main and src\java\test; then change to maven project;
Although rarely, but sometimes you will have 3rd party JARs that you need to put in your local repository for use in your builds, since they don't exist in any public repository like Maven Central. The JARs must be placed in the local repository in the correct place in order for it to be correctly picked up by Apache Maven
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=3.0 -Dpackaging=jar
Entity-->Dao(interface and imp)-->Service(interface and imp)-->Controller-->Jsp
Open a command prompt, go to your project directory and run: mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
The eclipse:eclipse portion will regenerate your project files etc, the last 2 properties are more for convenience but I like downloading the sources and javadoc.
After a failed attempt, maven will leave a small file in your local .m2 repository that will prevent any attempt to re-download the file unless the update interval has elapsed or you force the updates using the maven
-U
switch described in other answers.Just delete the folder for that artifact in your local m2 repository and update you project; a new download attempt will trigger.
rm -rf ~/.m2/repository/com/caucho/hessian/3.1.5
1) Create a maven project
mvn archetype:generate -DgroupId=com.howtodoinjava -DartifactId=Log4jTestProject
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=falseRun above command in your eclipse workspace or any other IDE you are working in. If you already have a project in your workspace, then directly go to step 3.
2) Convert the project to eclipse supported java project
mvn eclipse:eclipseAbove command will convert maven project to eclipse java project. Now, import the project to eclipse.
3) Update pom.xml file with log4j dependencies Add below given dependencies to pom.xml. view sourceprint?<dependency>
<groupid>log4j</groupid>
<artifactid>log4j</artifactid>
<version>1.2.17</version>
</dependency>Run below command to download required jars in your local system and update project runtime dependencies also.
mvn eclipse:eclipse4) Test the application with BasicConfigurator
package com.howtodoinjava;
03.import org.apache.log4j.BasicConfigurator;
04.import org.apache.log4j.Logger;
05.
06.public class Log4jHelloWorld {
07.
08.
static final Logger logger = Logger.getLogger(Log4jHelloWorld.class);
09.
10.
public static void main(String[] args)
11.
{
12.
//Configure logger
13.
BasicConfigurator.configure();
14.
logger.debug("Hello World!");
15.
}
16.}Output:
0 [main] DEBUG com.howtodoinjava.Log4jHelloWorld - Hello World!
- Maven + CRUD + Spring + Hibernate + MySQL/Sql Server 2008
- Spring MVC + Hibernate + Maven: Crud操作示例
- Spring MVC + Hibernate + Maven: Crud操作示例
- Spring MVC + Hibernate + Maven: Crud操作示例
- maven hibernate 实现对mysql简单的CRUD操作
- spring+springmvc+hibernate crud
- Maven + Spring + Hibernate + MySql Example
- Maven + Spring + Hibernate + MySql Example
- spring mvc3+hibernate+mysql的一个不错的CRUD例子
- Spring+Jersey+JPA+Hibernate+MySQL实现CRUD操作案例
- Maven + (Spring + Hibernate) Annotation + MySQL项目
- Spring Hibernate – Mysql and Maven Showcase
- Spring JPA Data + Hibernate + MySQL + Maven
- Maven + (Spring + Hibernate) Annotation + MySql Example
- Maven搭建springmvc+spring+hibernate+mysql框架
- Sql Server 数据库的CRUD
- maven构建spring mvc + spring data jpa+ sql server 配置
- Hibernate+Spring+Struts2+ExtJS开发CRUD功能
- 动态添加按钮
- 读取plist文件
- UITableViewController 的分组
- 使用Tool Bar切换视图
- web服务器的开启和php模块的开启
- Maven + CRUD + Spring + Hibernate + MySQL/Sql Server 2008
- 关于mysql的安装和在终端上简单的…
- 算法
- 关于mysql的安装和在终端上简单的…
- 图片框角处理
- 通过归档永久存储数据
- 自定义默认生成的导航栏 标题 颜色…
- iOS UIlabel 自动换行,文字自适应
- iOS中NSNotificationCenter…