断桥梅_个人页

个人头像照片 断桥梅
0
27
0

个人介绍

暂无个人介绍

擅长的技术

获得更多能力
通用技术能力:

暂时未有相关通用技术能力~

云产品技术能力:

暂时未有相关云产品技术能力~

阿里云技能认证

详细说明
暂无更多信息
暂无更多信息
正在加载, 请稍后...
暂无更多信息
  • 回答了问题 2019-07-17

    spring2.5 tomcat6 下会出现cpu 很高

    定位Java CPU高的线程的方法1,找到Java PID:ps -ef | grep java2,找到CPU最高的线程:top -Hp $pid,然后按 Shift T3,将得到的线程ID转换为十六进制。4,执行JStack,拿到所有线程状态,然后基于十六进制的线程ID进行搜索,看下当前线程正在执行什么操作。注意:1,如果CPU 100%时,此时执行jstack可能无法成功。这个时候记得看下gc.log日志,如果CPU持续100%很可能是在频繁FullGC。
    踩0 评论0
  • 回答了问题 2019-07-17

    请问:springMVC怎么使用log4j将数据写到数据库?

    楼主,看下Log4j官网中关于JDBCAppender的描述是否可以满足你的需求。链接:http://logging.apache.org/log4j/2.x/manual/appenders.html
    踩0 评论0
  • 回答了问题 2019-07-17

    网站平台需要在交易系统发起一笔交易后,进行新交易的提示,就像微博好友圈的新微博提示。采用什么办法来解决这个需求呢

    1,基于Ajax的长轮询方案 前端基于Ajax不断向后端轮询是否有新消息提醒,有的话展示在页面上。2,基于Servlet3的异步Servlet实现3,基于WebSocket实现
    踩0 评论0
  • 回答了问题 2019-07-17

    mybaitis批量插入怎么得到批量返回的自增ID

    如果希望在插入多条数据时得到每条插入数据的ID值,此时无法再使用MYSQL的主键自增功能,而是要自己来生成ID。可参考链接:http://meetrice.iteye.com/blog/89426
    踩0 评论0
  • 回答了问题 2019-07-17

    已经正式运行很久的web项目怎么进行mysql分库

    1,分库分表中间件可以参考Cobar或者MyCat。2,分库建立好后,会涉及到一个数据迁移的问题,可以参考Otter&Cannel
    踩0 评论0
  • 回答了问题 2019-07-17

    mybatis分页的

    1,前端和后端之间约定的信息应该是PageSize、PageNum。2,后端在分页之前先查询一把数据总数。3,基于数据总数、PageSize以及PageNum就可以计算出MySQL中需要的Limit和OffSet值。 代码示例:一,查询基类package com.freedom.dal.common; /** 分页查询的基类 */ class QueryBase { //数据总量 private Integer totalSize; //每页大小 private Integer pageSize; //当前页数 private Integer currentPage; // for paging private int startRow; private int endRow; protected Integer getDefaultPageSize() { return defaultPageSize; } public boolean isFirstPage() { return this.getCurrentPage().intValue() == 1; } public int getPreviousPage() { int back = this.getCurrentPage().intValue() - 1; if (back } public boolean isLastPage() { return this.getTotalPage() == this.getCurrentPage().intValue(); } public int getNextPage() { int back = this.getCurrentPage().intValue() + 1; if (back > this.getTotalPage()) { back = this.getTotalPage(); } return back; } public Integer getCurrentPage() { if (currentPage == null) { return defaultFristPage; } return currentPage; } public void setCurrentPageString(String pageString) { if (isBlankString(pageString)) { this.setCurrentPage(defaultFristPage); } try { Integer integer = new Integer(pageString); this.setCurrentPage(integer); } catch (NumberFormatException ignore) { this.setCurrentPage(defaultFristPage); } } public void setCurrentPage(Integer cPage) { if ((cPage == null) || (cPage.intValue() } private void setStartEndRow() { this.startRow = this.getPageSize().intValue() * (this.getCurrentPage().intValue() - 1) + 1; this.endRow = this.startRow + this.getPageSize().intValue() - 1; } public Integer getPageSize() { if (pageSize == null) { return getDefaultPageSize(); } return pageSize; } public boolean hasSetPageSize() { return pageSize != null; } public void setPageSizeString(String pageSizeString) { if (isBlankString(pageSizeString)) { return; } try { Integer integer = new Integer(pageSizeString); this.setPageSize(integer); } catch (NumberFormatException ignore) { } } private boolean isBlankString(String pageSizeString) { if (pageSizeString == null) { return true; } if (pageSizeString.trim().length() == 0) { return true; } return false; } public void setPageSize(Integer pSize) { if ((pSize == null) || (pSize.intValue() } public Integer getTotalItem() { if (totalSize == null) { return defaultTotleItem; } return totalSize; } public void setTotalItem(Integer tItem) { if (tItem == null) { throw new IllegalArgumentException('TotalItem can't be null.'); } this.totalSize = tItem; int current = this.getCurrentPage().intValue(); int lastPage = this.getTotalPage(); if (current > lastPage) { this.setCurrentPage(new Integer(lastPage)); } } public int getTotalPage() { int pgSize = this.getPageSize().intValue(); int total = this.getTotalItem().intValue(); int result = total / pgSize; if ((total == 0) || ((total % pgSize) != 0)) { result++; } return result; } public int getPageFristItem() { int cPage = this.getCurrentPage().intValue(); if (cPage == 1) { return 1; } cPage--; int pgSize = this.getPageSize().intValue(); return (pgSize * cPage) + 1; } public int getPageLastItem() { int cPage = this.getCurrentPage().intValue(); int pgSize = this.getPageSize().intValue(); int assumeLast = pgSize * cPage; int totalItem = getTotalItem().intValue(); if (assumeLast > totalItem) { return totalItem; } else { return assumeLast; } } public int getEndRow() { return endRow; } public void setEndRow(int endRow) { this.endRow = endRow; } public int getStartRow() { return startRow; } public void setStartRow(int startRow) { this.startRow = startRow; } protected String getSQLBlurValue(String value) { if (value == null) { return null; } return value + '%'; } public boolean nextPage() { if(this.currentPage != null && this.currentPage.intValue() >= this.getTotalPage()) return false; if(this.currentPage == null) { this.setCurrentPage(defaultFristPage); } else { this.setCurrentPage(getNextPage()); } return true; } public int getStart() { int startRow = getStartRow() - 1; return startRow > 0 ? startRow : 0; }} 二,DAO中基本逻辑1,生成查询基类,并将前端传递过来的pageSize和pageNum设置给查询基类。2,查询数据总量,将数据总量设置到查询基类中。3,查询。 三,xml配置SELECT FROM CONFIGS WHERE LIMIT #{start}, #{pageSize}
    踩0 评论0
  • 回答了问题 2019-07-17

    mybatis 批量新增时,怎么批量返回自增ID,数据库是mysql

    如果希望在插入多条数据时得到每条插入数据的ID值,此时无法再使用MYSQL的主键自增功能,而是要自己来生成ID。可参考链接:http://meetrice.iteye.com/blog/89426
    踩0 评论0
  • 回答了问题 2019-07-17

    mybatis的<if test>判断标签有没有类似sql的like '%text%'模糊匹配的?

    参考链接:http://lavasoft.blog.51cto.com/62575/1386870
    踩0 评论0
  • 回答了问题 2019-07-17

    JUnit+Spring+log4j+mybatis,测试时,控制台用log4j打印sql等状态

    不知道是否曲解了楼主的意思。由于一般而言需要配置连接池,因此我使用druid来实现打印SQL。链接:https://github.com/druid-io/druid
    踩0 评论0
  • 回答了问题 2019-07-17

    spring 在构造方法中调用注入对象为空

    试下这样是否能满足你的需求。@Componentpublic class ShiroManager extends DefaultWebSecurityManager {@Autowired private LoginRealm loginRealm; @Autowired private ShiroSessionManager shiroSessionManager; /** * 添加缓存,和验证机制支持 */ public ShiroManager() { super(); } @PostConstruct private void init(){ /**缓存器**/// EhCacheManager cacheManager = new EhCacheManager(); // cacheManager.setCacheManagerConfigFile('classpath:/ehcache-shiro.xml');// this.setCacheManager(cacheManager); /**认证中心**/ this.setRealm(loginRealm); /**session管理器**/ this.setSessionManager(shiroSessionManager);// this.setRememberMeManager(rememberMeManager);}}
    踩0 评论0
  • 回答了问题 2019-07-17

    Spring怎么注入 构造函数 有参数的bean ,而且要动态传递

    个人理解。我的理解是,你希望在Spring中配置一个单例的Bean,只是这个Bean中有两个状态值(age和size)是可一个动态被更新掉的。这样的话,你可以如下方式定义:@Componentclass Man{private volatile int age; private volatile int size; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public int getSize() { return size; } public void setSize(int size) { this.size = size; }}在其他的地方你可以随时更新Man中的age和size值。
    踩0 评论0
  • 回答了问题 2019-07-17

    spring 如何知道哪个bean是需要生成代理对象的?

    个人理解。resolveBeforeInstantiation可以理解为Spring给BeanPostProcessors开放的一个回调,即可以配置BeanPostProcessor,然后在postProcessBeforeInitialization或者postProcessAfterInitialization方法中直接实例化一个对象并返回,这样当Spring调用这个方法时发现已经生成了对象,就不会再调用doCreate进行生成了。你说的代理对象就是对BeanPostProcessor的一个具体实现,比如如果你希望对A Bean进行代理,那么可以配置一个BeanPostProcessor,在其中的postProcessBeforeInitialization方法中直接返回一个A 类的代理对象。
    踩0 评论0
  • 回答了问题 2019-07-17

    通过spring mvc如何将后台的值传到前台的html文件里(在线急等)

    如果希望在页面渲染过程中直接使用Controller中数据的话,Html是无法完成这个工作的,可以使用Velocity。
    踩0 评论0
  • 回答了问题 2019-07-17

    求救java怎么用spring自动掉方法呢

    如果DB中字段值的更新是由程序来触发的,可以在触发DB变更的代码那里判断下DB中值是否已经为0,如果为0那么调用action方法。如果无法在触发代码那里做事情的话,可以启一个异步任务,不断轮询DB中字段的值,如果为0后调用action方法,不过这种方法资源消耗有些多,慎用。
    踩0 评论0
  • 回答了问题 2019-07-17

    Spring使用@Scheduled进行定时任务,集群环境下如何保证只执行一个?

    这属于分布式环境下的状态同步问题,解决办法就是找一个单点记录状态信息,如你描述中的使用DB进行单点状态记录,Zookeeper也可以作为单点记录状态。思路很简单:在任务执行前读取DB,看下当前任务是否已经在其他节点上执行,如果没有,那么在DB中将执行状态改为执行中,当执行完毕后将任务执行状态改为已经结束。为了防止Tomcat 宕机导致的DB中状态未及时更新,可以增加一个开始执行时间字段,如果过了一段时间后依旧未更新为执行结束,那么可以认为执行该任务的Tomcat出现了异常情况。另外,如果使用ZK来记录状态的话,可以使用一种类型为Ephamal的类型来记录状态。
    踩0 评论0
  • 回答了问题 2019-07-17

    spring mvc从前台获取list类型数据后传入后台 不用json有其他方法吗

    一个可行的方法是:Request拿到一个以逗号分隔的字符串,然后进行Split,并转为List。代码如下: String listS = null;//从Request获取参数内容 String[] array = listS.split(','); List list = Arrays.asList(array);
    踩0 评论0
  • 回答了问题 2019-07-17

    spring mvc 为什么要以servlet为入口 ?

    个人理解。MVC中的C表示控制器,每个MVC框架都需要一个入口类接管所有Web请求,即MVC中的C。我个人认为这个入口类不一定非得是Servlet,比如WebX使用的就是Filter。如在web.xml中的配置代码如下: webx com.alibaba.citrus.webx.servlet.WebxFrameworkFilter excludes load.htm webx /*
    踩0 评论0
  • 回答了问题 2019-07-17

    Spring 使用 @Configuration配置, @Atowired 拿 bean 为null

    Spring会完成Bean的扫描、注册和管理,但前提条件是Spring自身要启动起来。因此,你需要使用ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class)来启动Spring,Spring在启动过程中会扫描各种配置,并完成Bean的注册和初始化。当Spring启动之后,你就可以通过getBean方法拿到想要的Bean了。
    踩0 评论0
  • 回答了问题 2019-07-17

    spring 注解的web程序 现在怎么修改成j2se 程序

    可以尝试使用SpringBoot,见链接:https://projects.spring.io/spring-boot/
    踩0 评论0
  • 回答了问题 2019-07-17

    spring定时器处理方法

    也可以使用Java自带的线程池,比Timer的一个优势是,如果执行任务挂掉,线程池会再次new一个线程补充到线程中。Eg:ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1);executorService.scheduleAtFixedRate(null,1,1, TimeUnit.DAYS);
    踩0 评论0
正在加载, 请稍后...
滑动查看更多
正在加载, 请稍后...
暂无更多信息