Spring-Boot 1.4.2参考声明:
spring.http.converters.preferred-json-mapper = jackson#用于HTTP消息转换的首选JSON映射器.设置为"gson"以强制使用Gson
我们做到了.
但仍然使用杰克逊.
最后,我们设法强制Spring-Boot在排除Maven中指向Jackson的所有传递依赖之后使用Gson.
现在的问题是.这是迫使Spring-Boot使用Gson而不是Jackson的唯一方法吗?我们真的需要排除指向杰克逊的所有传递依赖吗?首选的json-mapper设置还不够?
似乎在 Jpa QueryDsl 中我可以使用如下分页:
return new JPAQueryFactory(getEntityManager())
.selectFrom(entity)
.where(where_clause)
.orderBy(order_by_clause)
.offset(pageNumber * 20)
.limit(20)
.fetchResults();
Run Code Online (Sandbox Code Playgroud)
问题是:
是的,我知道 Spring-Data 已经为 QueryDsl 提供了分页和接口,但是由于 Spring-Data 不支持复杂的“order by”子句,我无法使用它:(
我将在 Spring Boot (1.4.2v) 中使用带有 swagger-ui 的 springfox (2.6.1v)。
它的配置看起来:
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.genericModelSubstitutes(ResponseEntity.class);
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我的招摇落后于 spring 安全性,我只需要允许管理员访问那里。
问题是允许 swagger-ui 在我的应用程序中工作的匹配器集应该是什么?
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("??? <<<what_should_be_here>>> ???") // what should be here?
.hasRole("TENANT_ADMIN");
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用:
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>11.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我想以编程方式删除客户端。
不幸的是,正如我所见,ClientsResource只有keycloak.realm("my-realm").clients()创建选项:
@POST
@Consumes(MediaType.APPLICATION_JSON)
Response create(ClientRepresentation clientRepresentation);
Run Code Online (Sandbox Code Playgroud)
有没有办法使用 REST API 删除客户端?还是故意没有这个选项?