forked from databricks/databricks-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.java
40 lines (34 loc) · 1.33 KB
/
App.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
package com.databricks.sdk;
import com.databricks.sdk.core.commons.CommonsHttpClient;
import com.databricks.sdk.core.http.HttpClient;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
@SpringBootApplication
@EnableWebSecurity
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
@Bean
public HttpClient getHttpClient() {
return new CommonsHttpClient.Builder().withTimeoutSeconds(30).build();
}
@Bean
public ObjectMapper getObjectMapper() {
ObjectMapper m = new ObjectMapper();
m.registerModule(new JavaTimeModule());
return m;
}
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((requests) -> requests
.anyRequest().permitAll());
return http.build();
}
}