• 大小: 0.13M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: 其他
  • 标签: 其他  

资源简介

chartroom-master.zip

资源截图

代码片段和文件信息

package com.chartroom.config;

import com.chartroom.util.PropertiesReader;
import com.chartroom.util.RedisInit;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * Created by icinfo on 2017-09-21.
 */
@Configuration
@Import({WebSocketConfig.class})
@ComponentScan(basePackages = “com.chartroom“)
public class SpringConfig {
    //属性配置文件
    @Bean
    public PropertyPlaceholderConfigurer propertyPlaceholderConfigurer(){
        PropertyPlaceholderConfigurer propertyPlaceholderConfigurer
                = new PropertyPlaceholderConfigurer();
        Resource jdbcResource = new ClassPathResource(“jdbc.properties“);
        Resource springResource = new ClassPathResource(“spring.properties“);
        propertyPlaceholderConfigurer.setLocations(jdbcResourcespringResource);
        return propertyPlaceholderConfigurer;
    }

    //redis配置
    @Bean
    public RedisConnectionFactory redisConnectionFactory(){
        JedisConnectionFactory jedisConnectionFactory =
                new JedisConnectionFactory();
        jedisConnectionFactory.setHostName(PropertiesReader.redisHost);
        jedisConnectionFactory.setPort(PropertiesReader.redisPort);
        jedisConnectionFactory.setPassword(PropertiesReader.redisPwd);
        jedisConnectionFactory.setTimeout(PropertiesReader.redisTimeout);
        return jedisConnectionFactory;
    }
    @Bean
    public StringRedisTemplate stringRedisTemplate(){
        StringRedisTemplate stringRedisTemplate =
                new StringRedisTemplate();
        stringRedisTemplate.setConnectionFactory(redisConnectionFactory());
        return stringRedisTemplate;
    }

    @Bean
    public RedisInit redisInit(){
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        JedisPool jedisPool = new JedisPool(jedisPoolConfigPropertiesReader.redisHostPropertiesReader.redisPort
                PropertiesReader.redisTimeoutPropertiesReader.redisPwd);
        Jedis jedis = jedisPool.getResource();
        jedis.set(“onlineCount““0“);
        jedis.close();
        return new RedisInit();
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-09-27 08:45  chartroom-master\
     目录           0  2017-09-27 08:45  chartroom-master\.idea\
     目录           0  2017-09-27 08:45  chartroom-master\.idea\artifacts\
     文件         301  2017-09-27 08:45  chartroom-master\.idea\artifacts\chartroom_war.xml
     文件        5237  2017-09-27 08:45  chartroom-master\.idea\artifacts\chartroom_war_exploded.xml
     文件         630  2017-09-27 08:45  chartroom-master\.idea\compiler.xml
     文件         141  2017-09-27 08:45  chartroom-master\.idea\encodings.xml
     文件         232  2017-09-27 08:45  chartroom-master\.idea\kotlinc.xml
     目录           0  2017-09-27 08:45  chartroom-master\.idea\libraries\
     文件         502  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_alibaba_fastjson_1_2_38.xml
     文件         510  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_fasterxml_classmate_1_0_0.xml
     文件         632  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_annotations_2_7_9.xml
     文件         583  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_core_2_7_9.xml
     文件         611  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_databind_2_7_9.xml
     文件         677  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_fasterxml_jackson_dataformat_jackson_dataformat_xml_2_8_5.xml
     文件         724  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_8_5.xml
     文件         574  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_fasterxml_woodstox_woodstox_core_5_0_3.xml
     文件         513  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__com_sun_mail_javax_mail_1_5_0.xml
     文件         524  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__commons_codec_commons_codec_1_9.xml
     文件         527  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__commons_dbcp_commons_dbcp_1_2_2.xml
     文件         593  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__commons_fileupload_commons_fileupload_1_3_1.xml
     文件         491  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__commons_io_commons_io_2_4.xml
     文件         546  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__commons_logging_commons_logging_1_2.xml
     文件         513  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__commons_pool_commons_pool_1_3.xml
     文件         515  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__javax_activation_activation_1_1.xml
     文件         471  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__javax_javaee_api_7_0.xml
     文件         599  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__javax_validation_validation_api_1_1_0_Final.xml
     文件         574  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__javax_websocket_javax_websocket_api_1_0.xml
     文件         425  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__jstl_jstl_1_2.xml
     文件         450  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__junit_junit_3_8_1.xml
     文件         562  2017-09-27 08:45  chartroom-master\.idea\libraries\Maven__mysql_mysql_connector_java_5_1_30.xml
............此处省略96个文件信息

评论

共有 条评论