-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWebmvcConfig.java
47 lines (42 loc) · 1.47 KB
/
WebmvcConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.zenika;
import com.mongodb.reactivestreams.client.MongoClient;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Configuration for the WEB MVC application.
*
* @author Guillaume DROUET
*/
@Configuration
public class WebmvcConfig implements WebMvcConfigurer {
/**
* {@inheritDoc}
*/
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("drawing");
}
/**
* Builds a new customizer that will enable HTTP/2.
*
* @param serverProperties the properties providing SSL configuration
* @return the bean
*/
@Bean
public JettyHttp2Customizer customizer(final ServerProperties serverProperties) {
return new JettyHttp2Customizer(serverProperties);
}
/**
* Builds a template that will be used to query the Mongo database.
* @param mongoClient the mongo client
* @return the bean
*/
@Bean
public ReactiveMongoTemplate reactiveMongoTemplate(final MongoClient mongoClient) {
return new ReactiveMongoTemplate(mongoClient, "nightclazz");
}
}