package test;
import com.pojo.Article;
import com.pojo.Category;
import com.pojo.User;
import dao.Interface.CategoryMapper;
import dao.Interface.IUserOperation;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class userserviceimp0Test {
private static ApplicationContext ctx;
static
{
ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
}
public static void main(String[] args)
{
IUserOperation mapper = (IUserOperation)ctx.getBean("userMapper");
//测试id=1的用户查询,根据数据库中的情况,可以改成你自己的.
System.out.println("得到用户id=1的用户信息");
User user = mapper.selectUserByID(1);
CategoryMapper categoryMapper=(CategoryMapper)ctx.getBean("CategoryMapper");
Category category=categoryMapper.selectByPrimaryKey(1);
//System.out.println(category.toString());
System.out.println(user.getUserAddress());
//得到文章列表测试
System.out.println("得到用户id为1的所有文章列表");
}
}
import com.pojo.Article;
import com.pojo.Category;
import com.pojo.User;
import dao.Interface.CategoryMapper;
import dao.Interface.IUserOperation;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class userserviceimp0Test {
private static ApplicationContext ctx;
static
{
ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
}
public static void main(String[] args)
{
IUserOperation mapper = (IUserOperation)ctx.getBean("userMapper");
//测试id=1的用户查询,根据数据库中的情况,可以改成你自己的.
System.out.println("得到用户id=1的用户信息");
User user = mapper.selectUserByID(1);
CategoryMapper categoryMapper=(CategoryMapper)ctx.getBean("CategoryMapper");
Category category=categoryMapper.selectByPrimaryKey(1);
//System.out.println(category.toString());
System.out.println(user.getUserAddress());
//得到文章列表测试
System.out.println("得到用户id为1的所有文章列表");
}
}