This commit is contained in:
ybb 2024-10-10 10:51:10 +08:00
commit 2f2741ed6a
2 changed files with 61 additions and 0 deletions

View File

@ -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();
}
}

View File

@ -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 );
}
}