如何设置docker keycloak base url
as参数?
我有以下nginx反向代理配置:
server {
listen 80;
server_name example.com;
location /keycloak {
proxy_pass http://example.com:8087/;
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试访问http://example.com/keycloak/时,我获得了一个keycloak http重定向到http://example.com/auth/而不是http://example.com/keycloak/auth/
有任何想法吗?
我的spring boot Web应用程序通过Datastax客户端使用Cassandra DB,连接如下:
public CassandraManager(@Autowired CassandraConfig cassandraConfig) {
config = cassandraConfig;
cluster = Cluster.builder()
.addContactPoint(config.getHost())
.build();
session = cluster.connect(config.getKeyspace());
}
Run Code Online (Sandbox Code Playgroud)
当我运行单元测试时,spring boot应用程序尝试加载CassandraManager Bean并连接到Cassandra DB,而不是单元测试,因为我不需要它.我收到以下错误:[localhost/127.0.0.1:9042] Cannot connect)
有没有办法避免加载这个Cassandra Manager Bean来运行我的UT,因为他们不需要连接到数据库?这样做是一种好习惯吗?
是否可以做类似的事情:
<ul>
<li *ngFor="let language of languages">
<a [routerLink]="['#' + language]">{{language}}</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
要么
<ul>
<li *ngFor="let language of languages">
<a fragment="language">{{language}}</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
保持不变url
并添加#en
,#es
还是#fr
取决于language
值是多少?我不能使它工作。
我在量角器中使用角度服务$ httpBackend对模拟的API运行我的e2e测试.
我已经有了selenium浏览器的调试日志:
afterEach(function() {
browser.manage().logs().get('browser').then(function(browserLog){
if(browserLog.length) {
for (var i = 0; i < browserLog.length; i++) {
if( typeof browserLog[i] !== 'undefined') {
console.log(
JSON
.parse(browserLog[i].message).message.parameters[0].value
);
}
};
}
});
});
Run Code Online (Sandbox Code Playgroud)
我想在我的httpBackend模块中打印每个请求的URL和标题(例如,对于用户资源):
$httpBackend
.whenGET(/^\/api\/users.*$/)
.respond(function(method, url, data, headers) {
var users = mockUserService.getData();
console.log(url);
console.log(headers);
return [200, users, {}];
});
Run Code Online (Sandbox Code Playgroud)
但是在httpBackend模块内的任何地方都没有记录任何内容.当我在我的应用程序中使用它时它工作正常,但是当我在量角器中使用它时它没有.
有没有办法在任何地方打印?即使在输出文本文件中?
我有以下Event
DTO课程:
@AutoValue
@JsonDeserialize(builder = AutoValue_Event.Builder.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class Event {
public static Event.Builder builder() {
return new AutoValue_Event.Builder();
}
public abstract UUID id();
@NotNull
public abstract Type type();
@NotNull
@JsonSerialize(using = LocalDateSerializer.class)
@JsonDeserialize(using = LocalDateDeserializer.class)
public abstract LocalDate date();
@AutoValue.Builder
public abstract static class Builder {
@JsonProperty("id")
public abstract Builder id(UUID id);
@JsonProperty("type")
public abstract Builder type(Type type);
@JsonProperty("date")
public abstract Builder date(LocalDate date);
}
}
Run Code Online (Sandbox Code Playgroud)
验证适用于type
和date
属性,并且JsonMappingException
当有效负载不正确时,杰克逊会按预期抛出.不幸的是,返回的错误消息text/plain
如下: …
我有以下型号:
export interface Content {
lang: string;
title: string;
}
Run Code Online (Sandbox Code Playgroud)
我需要验证contents FormArray
这个parent FormGroup
:
this.formBuilder.group({
defaultLang: ['', Validators.required],
contents: this.formBuilder.array([], Validators.minLength(1))
});
Run Code Online (Sandbox Code Playgroud)
对于Content
我的每个人,我contents FormArray
使用以下内容验证模型content FormGroup
:
this.formBuilder.group({
lang: ['', Validators.required],
title: ['', Validators.required]
});
Run Code Online (Sandbox Code Playgroud)
现在,我想补充以下content FormGroup
我contents FormArray
来验证每个Content
:
(<FormArray>parentFormGroup.controls['contents'])
.push(this.contentFormGroup);
Run Code Online (Sandbox Code Playgroud)
但是使用这种方法我无法验证这些规则:
Content
填写了其中一个字段,则会进行内容验证(这意味着要添加content FormGroup
到内容中contents FormArray
)content FormGroup
了contents FormArray
if if)lang
的Content
是defaultLang
的parent FormGroup …
我有以下代码:
eventBus.subscribe(new EventBusListener<NavigationEvent>() {
@Override
public void onEvent(Event<NavigationEvent> event) {
event.getPayload();
}
});
eventBus.subscribe(new EventBusListener<NotificationEvent>() {
@Override
public void onEvent(Event<NotificationEvent> event) {
event.getPayload();
}
});
Run Code Online (Sandbox Code Playgroud)
IntelliJ告诉我,我可以用lambda表达式替换这两个匿名类,如:
eventBus.subscribe((EventBusListener<NavigationEvent>) Event::getPayload);
eventBus.subscribe((EventBusListener<NotificationEvent>) Event::getPayload);
Run Code Online (Sandbox Code Playgroud)
编译效果很好,但在运行时,出现以下错误的应用程序崩溃:java.lang.IllegalArgumentException: Could not resolve payload type
引起getPayload()
的Event<T>
类.
我是缺少什么lamdbas
和generics
?
我有以下控制器建议:
@ControllerAdvice
public class ExceptionHandlerAdvice {
@ExceptionHandler(NotCachedException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ModelAndView handleNotCachedException(NotCachedException ex) {
LOGGER.warn("NotCachedException: ", ex);
return generateModelViewError(ex.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
它在大多数情况下工作得很好但是当从使用@Async注释的方法抛出NotCachedException时,异常处理不正确.
@RequestMapping(path = "", method = RequestMethod.PUT)
@Async
public ResponseEntity<String> store(@Valid @RequestBody FeedbackRequest request, String clientSource) {
cachingService.storeFeedback(request, ClientSource.from(clientSource));
return new ResponseEntity<>(OK);
}
Run Code Online (Sandbox Code Playgroud)
这是Executor的配置:
@SpringBootApplication
@EnableAsync
public class Application {
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
SettingsConfig settings = context.getBean(SettingsConfig.class);
LOGGER.info("{} ({}) started", settings.getArtifact(), settings.getVersion());
createCachingIndex(cachingService);
}
@Bean(name …
Run Code Online (Sandbox Code Playgroud) 我们构建了一个由Apache服务器提供服务的Angular v> 4应用程序.我知道它存在Angular Universal for Node服务器以允许服务器端呈现.是否存在Apache Server的任何等效项?
谢谢.
我定义index.js
了Router
来自 react router 5 的入口点(不是你不应该在 <Router> 之外使用 <Link>的副本):
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<App />
</Router>
</Provider>,
document.getElementById('app'),
);
Run Code Online (Sandbox Code Playgroud)
但我仍然有著名的You should not use <Link>
outside a<Router>
error on my component using Material UI Popover
:
const InterventionMarker = ({ marker, history }) => {
const [anchorEl, setAnchorEl] = React.useState(null);
const handleClick = event => setAnchorEl(event.currentTarget);
const handleClose = () => setAnchorEl(null);
const open = Boolean(anchorEl);
return (
<MarkerWithLabel
onClick={handleClick}
...other-props
>
<div> …
Run Code Online (Sandbox Code Playgroud) angular ×3
java-8 ×2
spring ×2
angularjs ×1
apache ×1
auto-value ×1
cassandra ×1
datastax ×1
docker ×1
e2e-testing ×1
generics ×1
httpbackend ×1
jackson ×1
java ×1
keycloak ×1
lambda ×1
nginx ×1
ngmocke2e ×1
protractor ×1
react-router ×1
reactjs ×1
server-side ×1
unit-testing ×1
validation ×1