在我的申请中
`CategoryDao` is a `interface`, `Category` is a model `class`
Run Code Online (Sandbox Code Playgroud)
我的代码是
CategoryTestCase.java
package com.binod.onlineshopping.category.test;
import com.binod.onlineshopping.category.dao.CategoryDao;
import com.binod.onlineshopping.category.model.Category;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.testng.AssertJUnit.assertEquals;
/**
* Created by binod on 7/13/17.
*/
public class CategoryTestCase {
private static AnnotationConfigApplicationContext context;
private static CategoryDao categoryDao;
private Category category;
@BeforeClass
public static void init() {
context = new AnnotationConfigApplicationContext();
context.refresh();
categoryDao = (CategoryDao) context.getBean("categoryDao");
}
@Test
public void addCategory(){
category=new Category();
category.setCname("Television");
category.setCdescription("TV is the product");
category.setImageUrl("c_Tv.png");
assertEquals("sucessfully inserted..",true,categoryDao.addCategory(category)); …Run Code Online (Sandbox Code Playgroud) 我看到很多教程,有些人使用maven dependency这样的方式
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
有些人用maven dependency这样的方式
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
maven <version>${spring.version}</version>和<version>4.3.3.RELEASE</version>maven 之间的主要区别是什么?