最近接受的项目中用spring配置了一个TimeZone对象:

<bean id ="timeZone4Job" class="java.util.TimeZone" factory-method="getTimeZone">
<constructor-arg value="GMT+8:00"/>
</bean>

以前是运行在 1.7 中,没什么问题。今天换了1.8的sdk,spring开始报错,发现原来在1.8里面新加入了方法 getTimeZone(ZoneId zoneId),spring会尝试转换GMT+8:00为ZoneId,而坑爹的是ZoneId.of(String zoneId) 支持的格式少,直接报错。

修改Spring配置如下,问题解决。

<bean id ="timeZone4Job" class="java.util.TimeZone" factory-method="getTimeZone">
<constructor-arg value="GMT+8:00" type="String"/>
</bean>

java.util.TimeZone 新加方法 getTimeZone(ZoneId zoneId) 导致的问题的更多相关文章

  1. java:数组操作工具类 java.util.Arrays包 主要方法详解

    Arrays类位于Java.util包下,是一个对数组操作的工具类,现将Arrays类中的方法做一个总结(JDK版本:1.6.0_34).Arrays类中的方法可以分为八类: sort(对数组排序) ...

  2. java.util.List接口的方法subList()的使用注意事项

    JDK中,List接口有一个实例方法List<E> subList(int fromIndex, int toIndex), 其作用是返回一个以fromIndex为起始索引(包含),以to ...

  3. JAVA学习.java.sql.date 与java.util.date以及gettime()方法的分析

    java.sql.Date 是针对SQL语句使用的,它只包含日期而没有时间部分. java.util.Date 就是在除了SQL语句的情况下面使用. 它都有getTime方法返回毫秒数,返回的是自19 ...

  4. 使用java.util.List的subList方法进行分页

    java.util.List中有一个subList方法,用来返回一个list的一部分视图. List<E> subList(int fromIndex, int toIndex); 它返回 ...

  5. 【java】彩票中奖码生成器:java.util.Random里的方法public int nextInt(int bound)

    package 彩票中奖码生成器; import java.util.Random; public class TestRandom { public static void main(String[ ...

  6. Java反射、动态加载(将java类名、方法、方法参数当做参数传递,执行方法)

    需求:将java类名.方法.方法参数当做参数传递,执行方法.可以用java的动态加载实现   反射的过程如下:     第一步:通过反射找到类并创建实例(classname为要实例化的类名,由pack ...

  7. java util包概述

    util是utiliy的缩写,意为多用途的,工具性质的包这个包中主要存放了:集合类(如ArrayList,HashMap等),随机数产生类,属性文件读取类,定时器类等类.这些类极大方便了Java编程, ...

  8. java.util包详解

    介绍Java的实用工具类库java.util包.在这个包中,Java提供了一些实用的方法和数据结构.本章介绍Java的实用工具类库java.util包.在这个包中,Java提供了一些实用的方法和数据结 ...

  9. Java 8 (11) 新的日期和时间API

    在Java 1.0中,对日期和时间的支持只能依赖java.util.Date类.这个类只能以毫秒的精度表示时间.这个类还有很多糟糕的问题,比如年份的起始选择是1900年,月份的起始从0开始.这意味着你 ...

随机推荐

  1. win10上安装Docker

    方法1:具体我没有试过,不知道win10下可以么.http://blog.csdn.net/zistxym/article/details/42918339 方法2: 先安装VirtualBox(下载 ...

  2. golang append

    1) Append a slice b to an existing slice a: a = append(a, b...) 2) Copy a slice a to a new slice b: ...

  3. 配置Pylint for Python3.5

    事件的缘由是因为在Ubuntu16.04 下面安装了Visual Studio Code, 再编辑的时候说需要Pylint来检查语法,我系统的默认的Python 版本是python2,而我现在正在学习 ...

  4. Solution to “VirtualBox can't operate in VMX root mode” error in Windows 7

    I was trying out various virtualization solutions on Windows 7, including Microsoft Virtual PC and V ...

  5. 如何生成ipa文件

    xcode--Product--Archive 弹出Organizer-Archives选择Distribute---Save for EnterPrise or Ad_Hoc Deployment- ...

  6. Xenia and Bit Operations(线段树单点更新)

    Xenia and Bit Operations time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  7. Malek Dance Club(递推)

    Malek Dance Club time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  8. Oracle---.oracle函数

    数值型函数: 绝对值: ABS(x) [功能]返回x的绝对值 [参数]x,数字型表达式 [返回]数字 [示例] select abs(100),abs(-100) from dual;-------- ...

  9. 【转载】CSS 盒子模型

    转处:http://www.cnblogs.com/sunyunh/archive/2012/09/01/2666841.html 说在Web世界里(特别是页面布局),Box Model无处不在.下面 ...

  10. 转:Transform Web.Config when Deploying a Web Application Project

    Introduction One of the really cool features that are integrated with Visual Studio 2010 is Web.Conf ...