是否可以使用r2dbc-mssql?在属性文件中指定默认架构?
该连接可以正常工作:
spring:
r2dbc:
url: 'r2dbc:mssql://zzzzz.database.windows.net:1433/dbname'
username: 'xxxxxx'
password: 'xxxxxx'但我必须使用静态模式:
@Table("schemaname.foo")
public class Foo {
@Id
private Long id;我在r2dbc-postgresql:https://github.com/pgjdbc/r2dbc-postgresql/issues/37中发现了类似的东西
发布于 2020-10-02 09:21:56
在Spring应用程序中,我认为您可以执行一个sql语句来切换@Configuration类的@Configuration方法中的模式。
@Configuration
class DatabaseConfig{
@Autowired
ConnectionFactory connectionFactory;
@PostConstruct
void init(){
Mono.from(connectionFactory.getConnection())
.flatMap(c->c.createStatement("switch to your schema here, different database has different commands here").execute())
.subscribe()
}
}https://stackoverflow.com/questions/64160333
复制相似问题