@Bean public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) { log.debug("Configuring Hazelcast"); Config config = new Config(); config.setInstanceName("soesmses"); config.getNetworkConfig().setPort(5701); config.getNetworkConfig().setPortAutoIncrement(true); // In development, remove multicast auto-configuration if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT)) { System.setProperty("hazelcast.local.localAddress", "127.0.0.1"); config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false); config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false); } config.getMapConfigs().put("default", initializeDefaultMapConfig()); config .getMapConfigs() .put("com.soesoft.soesmses.domain.*", initializeDomainMapConfig(jHipsterProperties)); config .getMapConfigs() .put("clustered-http-sessions", initializeClusteredSession(jHipsterProperties)); hazelcastInstance = HazelcastInstanceFactory.newHazelcastInstance(config); return hazelcastInstance; }
@Bean public BasicDataSource dataSource() { BasicDataSource basicDataSource = new BasicDataSource(); basicDataSource.setDriverClassName(environment.getProperty("jdbc.driverClassName")); basicDataSource.setUrl(environment.getProperty("jdbc.url")); basicDataSource.setUsername(environment.getProperty("jdbc.username")); basicDataSource.setPassword(environment.getProperty("jdbc.password")); // properties below are to improve performance basicDataSource.setTestWhileIdle(true); basicDataSource.setTestOnBorrow(true); basicDataSource.setTestOnReturn(false); basicDataSource.setValidationQuery(environment.getProperty("jdbc.validationQuery")); basicDataSource.setTimeBetweenEvictionRunsMillis(30000); basicDataSource.setMaxActive(100); basicDataSource.setMinIdle(10); basicDataSource.setMaxWait(10000); basicDataSource.setInitialSize(10); basicDataSource.setRemoveAbandonedTimeout(60); basicDataSource.setRemoveAbandoned(true); basicDataSource.setLogAbandoned(true); basicDataSource.setMinEvictableIdleTimeMillis(30000); // create scheme if (!"false".equals(System.getProperty("create_scheme"))) { JdbcTestUtils.executeSqlScript( new JdbcTemplate(basicDataSource), new ClassPathResource("/sql/create_scheme.sql"), false); } return basicDataSource; }