springboot中fastJson和properties文件占位符解析

版权声明:未经授权,不得转载。 https://blog.csdn.net/soulsda/article/details/83687039

1.介绍

   fastJson是阿里巴巴出品的一款速度极快的json解析工具

   properties配置文件有时无法解析某些占位符

2.使用

   直接放到springboot启动类中即可


    /**
     * 解析fastjson
     * @return
     */
    @Bean
    public HttpMessageConverters fastJsonHttpMessageConverters() {
        FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
        HttpMessageConverter<?> converter = fastConverter;
        return new HttpMessageConverters(converter);
    }

    /**
     * 用于properties文件占位符解析
     * @return
     */
    @Bean
    public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
        return new PropertySourcesPlaceholderConfigurer();
    }

3.闲谈

    没什么好讲的,都是些基础工具,放进去就可以用

猜你喜欢

转载自blog.csdn.net/soulsda/article/details/83687039
今日推荐