task1
This commit is contained in:
commit
2f2741ed6a
|
@ -0,0 +1,23 @@
|
|||
package com.hnucm.spring;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
// id = userService
|
||||
// @Component =Service =Controller =Repository
|
||||
@Service
|
||||
public class UserService {
|
||||
|
||||
// Autowired Spring自动注入 + setter+getter
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
|
||||
|
||||
// 如何调用Spring容器 finduser
|
||||
public void findUser(){
|
||||
userDao.findUser();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.hnucm.spring;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue