第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

Spring - 更改 persist_logins 的架構(gòu)連接

Spring - 更改 persist_logins 的架構(gòu)連接

翻閱古今 2023-10-12 17:05:17
我正在開發(fā) Spring Boot Web 應(yīng)用程序,并且正在實(shí)現(xiàn)“記住我”功能。我在網(wǎng)絡(luò)安全配置中定義了以下內(nèi)容:http.authorizeRequests().and()                    .rememberMe().tokenRepository(this.persistentTokenRepository())                    .tokenValiditySeconds(1 * 24 * 60 * 60); // 24h和@Bean        public PersistentTokenRepository persistentTokenRepository() {            JdbcTokenRepositoryImpl db = new JdbcTokenRepositoryImpl();            db.setDataSource(dataSource);            return db;        }問題是,當(dāng)我在 html 頁面上標(biāo)記該選項(xiàng)時(shí),Spring 嘗試在我的數(shù)據(jù)庫的默認(rèn)架構(gòu)中添加一個(gè)標(biāo)記 ->“public”。有什么方法可以更改該選項(xiàng)的默認(rèn)架構(gòu)嗎?其他所有內(nèi)容都通過此屬性正確鏈接到正確的架構(gòu)上:spring.jpa.properties.hibernate.default_schema=another_schema_name我嘗試制作 JdbcTokenRepositoryImpl 類的個(gè)人實(shí)現(xiàn),但我找不到更改架構(gòu)的方法。我在網(wǎng)上查了一下,但什么也沒找到。謝謝
查看完整描述

1 回答

?
繁星coding

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超4個(gè)贊

您可以以不同的方式初始化您的 dataSource 變量,這些變量與您在 PersistentTokenRepository bean 中使用的變量不同。大多數(shù)數(shù)據(jù)源都支持模式設(shè)置。例如 Spring 的 org.springframework.jdbc.datasource.DriverManagerDataSource :


@Bean(name = "dataSource")

public DataSource getDataSource() {

  DriverManagerDataSource dataSource = new DriverManagerDataSource();

  // ... tipicly set username, password, driver class name, jdbc Url

  dataSource.setSchema(schema);

  return dataSource;

}

您可以通過提到的屬性控制架構(gòu):(spring.jpa.properties.hibernate.default_schema)


@Value("${spring.jpa.properties.hibernate.default_schema}")

private String schema;


查看完整回答
反對 回復(fù) 2023-10-12
  • 1 回答
  • 0 關(guān)注
  • 113 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號