- 博客(18)
- 资源 (11)
- 问答 (1)
- 收藏
- 关注
原创 线程池ExecutorService空闲线程的个数
keepAliveTime:表示线程没有任务执行时最多保持多久时间会终止。默认情况下,只有当线程池中的线程数大于corePoolSize时,keepAliveTime才会起作用,直到线程池中的线程数不大于corePoolSize,即当线程池中的线程数大于corePoolSize时,如果一个线程空闲的时间达到keepAliveTime,则会终止,直到线程池中的线程数不超过corePoolSize。但...
2018-06-28 20:02:33 22009 1
原创 线程池ExecutorService的4种拒绝策略
ThreadPoolExecutor.AbortPolicy:丢弃任务并抛出RejectedExecutionException异常。ThreadPoolExecutor.DiscardPolicy:也是丢弃任务,但是不抛出异常。ThreadPoolExecutor.DiscardOldestPolicy:丢弃队列最前面的任务,执行后面的任务ThreadPoolExecutor.CallerR...
2018-06-28 18:42:35 9028
原创 打印所有SpringBoot载入的bean
@SpringBootApplicationpublic class Application { private static final Logger logger = LoggerFactory.getLogger(Application.class); public static void main(String[] args) { ApplicationC...
2018-06-28 09:57:22 9245 1
转载 @Value使用注意事项
在spring mvc架构中,如果希望在程序中直接使用properties中定义的配置值,通常使用一下方式来获取: @Value("${tag}") private String tagValue;但是取值时,有时这个tagvalue为NULL,可能原因有:使用static或final修饰了tagValue,如下: private static String tagValue; ...
2018-06-22 16:45:38 5227
原创 thymeleaf的if条件--踩坑,合并单元格
for循环生成表格时:<!--如果带该if条件,若值为0或0.0时则不显示该td,会造成同一行后面的td空白,后面的数字会移到该单元格显示--><!--<td th:if="${info.num1}" th:text="${info.num1}"></td> --><td th:text="${info.num1}"
2018-06-20 10:13:31 20844
原创 thymeleaf显示表格,for循环
<table border="1"> <tr> <th>用户名</th> <th>邮箱</th> <th>状态变量:index</th> <th>状态变量:count&
2018-06-13 11:17:05 52271
原创 SpringBoot获取配置值的两种方式
方法一:使用@Value()直接取值application.ymlweather: dt: 2018-06-09 humidity: 26AWeatherController.java@RestControllerpublic class AWeatherController { @Value("${weather.dt}") private String dt; ...
2018-06-10 11:28:48 12816
转载 Spring 配置中的 default-lazy-init="true"
spring的容器是提供了lazy-load的,即默认的缺省设置是bean没有lazy-load,该属性处于false状态,这样导致spring在启动过程导致在启动时候,会默认加载整个对象实例图,从初始化ACTION配置、到service配置到dao配置、乃至到数据库连接、事务等等。 这么庞大的规模,难怪spring的启动时间要花将近1分钟。尝试了一下,把beans的default-lazy-in...
2018-06-08 22:17:57 4231 1
转载 spring配置中parent和abstract作用
关于spring中的bean定义,parent属性是什么意思? 1.<bean id="txProxyTemplate" abstract="true"class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"><property name="transactionAttribut...
2018-06-08 22:12:59 2783
原创 thymeleaf th:text拼接
html页面开头:<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">比如:当前日期:2018年6月8日,超出平均值30%,对应如下源码:当前日期:<span th:text="${dt}"></span>超出平均值 <span th:te
2018-06-08 21:41:03 32710 2
原创 div,p,h1,h2...h6自动换行
<body> <p>This is a <u>parragraph</u>.</p> 自动换行测试 自动换行测试 <h1>H1</h1> <h2>H2</h2> 自动换行测试 自动换行测试 <h6>H6<
2018-06-08 18:39:13 4548
转载 @Autowired和@Resource的区别
@Autowired是Spring支持的注解@Resource 是JDK1.6支持的注解@Autowired默认按类型装配@Resource默认按名称装配@Resource装配顺序 1. 如果同时指定了name和type,则从Spring上下文中找到唯一匹配的bean进行装配,找不到则抛出异常 2. 如果指定了name,则从上下文中查找名称(id)匹配的bean进行装配,找不到则抛出异常 3...
2018-06-07 22:43:48 275
原创 @Repository,@Service,@Resource不指定value,name时是否起作用
@Repository与@Resource@Repositorypublic interface UserDao {}@Service("UserService")public class UserService { //@Resource(name = "UserDao") //报错 @Resource//正确 private UserDao use...
2018-06-07 22:34:53 6826 1
原创 Java,Class.getResource,Class.getClassLoader().getResource获取文件
Class.getResource(String path)path不以’/'开头时,默认是从此类所在的包下取资源;(取包下的资源时使用该方法,开头不必带/)path 以’/'开头时,则是从ClassPath根下获取;(取根下的资源使用该方法,开头带/。(取不是包下的资源使用该方法))Class.getClassLoader().getResource(String path)...
2018-06-05 22:05:31 934
原创 Java读取和写入图片
File originalFile = new File("D:\\test\\dabai.jpg");//指定要读取的图片 try { File result = new File("D:\\test0\\dabai.jpg");//要写入的图片 if (result.exists()) {//校验该文件是否已存在...
2018-06-05 21:14:38 43650 4
原创 InitializingBean,DisposableBean ,PostConstruct,PreDestroy作用与执行顺序
package com.springmvc.entity;import org.hibernate.validator.constraints.Length;import org.springframework.beans.factory.DisposableBean;import org.springframework.beans.factory.InitializingBean;i...
2018-06-02 19:42:57 1648
转载 InitializingBean,init-method作用与区别
InitializingBean接口为bean提供了初始化方法的方式,它只包括afterPropertiesSet方法,凡是继承该接口的类,在初始化bean的时候会执行该方法。测试程序如下:[java] view plain copyimport org.springframework.beans.factory.InitializingBean; public class TestInitia...
2018-06-02 18:25:48 6054
mhd raw metaimage java读取类
2017-10-18
commons-lang-2.5.jar
2016-07-08
commons-configuration-1.6.jar
2016-07-08
android通过servlet与服务器验证用户信息
2016-03-26
全国省市县区域名称
2015-11-17
android布局中用到dimension,这样的作用是什么?好处是?
2015-12-26
TA创建的收藏夹 TA关注的收藏夹
TA关注的人