Skip to content

Commit

Permalink
Add Postgres optimization configuration for JDBC HTTP sessions.
Browse files Browse the repository at this point in the history
  • Loading branch information
msqr committed Jul 10, 2024
1 parent 72b94ed commit 9b320f5
Showing 1 changed file with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* ==================================================================
* WebConfig.java - 9/10/2021 3:20:51 PM
*
*
* Copyright 2021 SolarNetwork.net Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ==================================================================
*/
Expand All @@ -40,6 +40,9 @@
import org.springframework.format.datetime.standard.TemporalAccessorParser;
import org.springframework.format.datetime.standard.TemporalAccessorPrinter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.session.config.SessionRepositoryCustomizer;
import org.springframework.session.jdbc.JdbcIndexedSessionRepository;
import org.springframework.session.jdbc.PostgreSqlJdbcIndexedSessionRepositoryCustomizer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.cors.CorsConfiguration;
Expand All @@ -65,7 +68,7 @@

/**
* Web layer configuration.
*
*
* @author matt
* @version 1.3
*/
Expand Down Expand Up @@ -125,6 +128,11 @@ public JSONView json() {
return view;
}

@Bean
public SessionRepositoryCustomizer<JdbcIndexedSessionRepository> sessionRepositoryCustomizer() {
return new PostgreSqlJdbcIndexedSessionRepositoryCustomizer();
}

@Bean
public TimeZonePropertySerializer timeZonePropertySerializer() {
return new TimeZonePropertySerializer();
Expand Down

0 comments on commit 9b320f5

Please sign in to comment.