public class Mysource {
public void after(){
System.out.println("发布文章中");
}
}
public interface NewsService {
void doNewspapers(News news);
}
public class NewsServiceImpl implements NewsService{
private NewsDao newsDao ;
public void setNewsdao(NewsDao newsDao) {
this.newsDao = newsDao;
}
@Override
public void doNewspapers(News news) {
newsDao.Newspapers(news);
}
}
public interface NewsDao {
void Newspapers(News news);
}
public class TestAOP {
@Test
public void test1(){
ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
NewsService service=context.getBean("newsService",NewsService.class);
News news=new News("赚钱秘籍",5);
service.doNewspapers(news);
}