You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So today I was happy coding a Spring boot project of mine and wanted to use a file based session using H2 for a development environment. Since my application used another type of primary datasource (postgresql) I went on to figure out how to do it.
After setting my own beans, the application failed because the initializer was not run on the proper DataSource, it used the primary one. After some code digging I found out that the bean in spring boot is configured like this:
After finding this out, I happily defined my own JdbcSessionDataSourceInitializer bean annotating dataSource with @SpringSessionDataSource and went on coding. After some thinking I believe this makes sense to be changed in the library.
The text was updated successfully, but these errors were encountered:
Davidonium
changed the title
dataSource in JdbcSessionConfiguration$jdbcSessionDataSourceInitializer should be annotated with @SpringSessionDataSource
dataSource in JdbcSessionConfiguration$jdbcSessionDataSourceInitializer should be annotated with @SpringSessionDataSource
Dec 30, 2020
Thanks for the suggestion. I think that makes sense and would align the DataSource that's injected into the JdbcSessionDataSourceInitializer with the DataSource that's injected into Boot's JdbcHttpSessionConfiguration subclass.
wilkinsona
changed the title
dataSource in JdbcSessionConfiguration$jdbcSessionDataSourceInitializer should be annotated with @SpringSessionDataSource
Auto-configured JdbcSessionDataSourceInitializer does not use the @SpringSessionDataSource if available
Jan 12, 2021
So today I was happy coding a Spring boot project of mine and wanted to use a file based session using H2 for a development environment. Since my application used another type of primary datasource (postgresql) I went on to figure out how to do it.
After setting my own beans, the application failed because the initializer was not run on the proper DataSource, it used the primary one. After some code digging I found out that the bean in spring boot is configured like this:
After finding this out, I happily defined my own
JdbcSessionDataSourceInitializer
bean annotatingdataSource
with@SpringSessionDataSource
and went on coding. After some thinking I believe this makes sense to be changed in the library.The end result would be
Thoughts?
The text was updated successfully, but these errors were encountered: