1、在pom.xml中添加依赖

接着需要在右侧的任务栏中刷新,就可以看到如图所示,依赖已经添加好了

2、创建Max类
两个数比较大小的待测程序,如下:

接着去spring.xml中配置Max的bean:

返回Max类,将光标放在public class Max这里,按Shift+Ctrl+T(或者Ait+Enter)出现如图所示:

选择Create New Test,接着配置测试方法:

配置完成后它会自动生成在test包中:

在MaxTest测试类中添加语句:

接着就可以运行MaxTest:

接着可以运行MaxApp就可以出现结果:

网友评论