ssh框架中,工具类调用service层方法(参考https://www.cnblogs.com/l412382979/p/8526945.html)
代码如下:
package common.dataService; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import com.womow.uap.bizc.IUapusersBizc;
import com.womow.vo.DBVo; @Component//声明spring组件
public class DBTool {
@Autowired
private IUapusersBizc uapusersBizc; public static DBTool instance ; public void setUapusersBizc(IUapusersBizc uapusersBizc) {
this.uapusersBizc = uapusersBizc;
} @PostConstruct//通过@PostConstruct方法实现Bean初始化之前和销毁之前的自定义操作
public void init(){//init方法是在构造函数执行之后 才执行的
instance = this;
instance.uapusersBizc = this.uapusersBizc;
} public DBVo getDBVoInfo(){
DBVo dbVo = null;
try {
dbVo = uapusersBizc.findDBInfo();
} catch (Exception e) {
e.printStackTrace();
}
return dbVo;
}
}
ssh框架中,工具类调用service层方法(参考https://www.cnblogs.com/l412382979/p/8526945.html)的更多相关文章
- ssh框架,工具类调用service层方法
解决方法: @Component//声明为spring组件 public class CopyFileUtil{ @Autowired private DataFileManager dataFile ...
- 解决:SSM框架中普通类调用Service的问题 (转)
http://blog.csdn.net/gwd1154978352/article/details/73480959
- 在Java filter中调用service层方法
在项目中遇到一个问题,在 Filter中注入 Serivce失败,注入的service始终为null.如下所示: public class WeiXinFilter implements Filter ...
- 静态工具类注入service的方法
http://blog.sina.com.cn/s/blog_6e2d53050102wl3x.html
- 在ssh框架中service,action,jsp,formbeam,dao的调用顺序
本文来自:http://blog.csdn.net/w_basketboy24/article/details/8642846 jsp发起请求. actionform封装请求参数. action接受请 ...
- SpringBoot在自定义类中调用service层等Spring其他层
解决方案: 1.上代码 @Component public class ServerHandler extends IoHandlerAdapter { @Autowired protected He ...
- 在SSH框架中使用Spring的好处(转)
以下是我总结下今天笔试中SSh中的总结: 在SSH框架中spring充当了管理容器的角色.我们都知道Hibernate用来做持久层,因为它将JDBC做了一个良好的封装,程序员在与数据库进行交互时可以不 ...
- TimerTask的run()方法里面如何调用service层里面的方法
在java的spring框架中,用Timer和TimerTask来实现定时任务,有时我们要在TimerTask的子类的重写run方法里,调用service层的方法. 但是不管是spring.xml配置 ...
- Java:集合框架的工具类
集合框架的工具类 Arrays:里面都是静态方法,直接用来对各种集合进行操作的公有方法. Collections:里面都是静态方法,直接用来对各种集合进行操作的公有方法. 包括: 1.asList将数 ...
随机推荐
- 无法访问SVN历史记录的问题
今天在eclipse中发现无法访问SVN的历史记录,提示条目不可读,截图如下: 用小乌龟客户端试了试也不行,截图如下: 最后解决办法是在SVN服务器上将代码仓库中conf目录下的svnserve. ...
- pseudotime专题
review:Computational Methods for Trajectory Inference from Single-Cell Transcriptomics Tools/Algorit ...
- canvas学习之柱状图
项目地址:http://pan.baidu.com/s/1nvhWrwP 因为最近项目中使用到了图表,而且个人一直希望研究canvas,所以最近几天花时间对canvas好好研究了一下,并写了一个dem ...
- android-------Android Studio使用MAT分析工具遇到的错误
今天主要介绍一下我使用MAT工具分析文件时遇到的一个错误 Error opening heap dump 'a.hprof'. Check the error log for further deta ...
- git 提交代码场景
1.首次提交代码到master git init git add . git commit -m '' git remote add origin +address git push -u origi ...
- Android实现选择题答题(包括单选、多选和答题卡)
在线答题demo,具体代码是一年多前完成的,比较简单,不再贴出,请参见Github. 主要功能: 单选:点击选项直接进入下一题.多选:选择多个选项,向右滑动进入下一题.答题卡:点击题号重新进入答题界面 ...
- 4月12 php练习
php中输出 <?php echo'hello'; php中打印多个div <?php for($i=1;$i<=100;$i++) { ?> <div style=&q ...
- 关于export和export default的区别
ES6的模块化中,export与export default都可以用于导出常量.函数.文件.模块等,我们可以通过在其它文件或模块中import(常量.函数.文件.模块)的方式导入,但在一个文件或模块中 ...
- 八、持久层框架(MyBatis)
一.基于MyBatis的CRUD 1.首先是配置文件Category.xml修改 一次性修改配置文件Category.xml,提供CRUD对应的sql语句. <?xml version=&quo ...
- C++ leetcode Longest Substring Without Repeating Characters
要开学了,不开森.键盘声音有点大,担心会吵到舍友.今年要当个可爱的技术宅呀~ 题目:Given a string, find the length of the longest substring w ...