Skip to content

Instantly share code, notes, and snippets.

View ahndmal's full-sized avatar
😔
stand with my homeland Ukraine

Andrii Maliuta ahndmal

😔
stand with my homeland Ukraine
View GitHub Profile
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://postman-echo.com/get"))
.version(HttpClient.Version.HTTP_2)
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandler.asString());
assertThat(response.version(), equalTo(HttpClient.Version.HTTP_1_1));
private final static String jsonUrl = "https://api.privatbank.ua/p24api/exchange_rates?json&date=01.04.2020";
private final static String path = "D:\\Programming\\java\\projects\\documents-parsing\\src\\resources\\json\\cats.json";
private final static String newFile = "D:\\Programming\\java\\projects\\documents-parsing\\src\\resources\\json\\catsFromGson.json";
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();
Gson gson = gsonBuilder.create();
public class JacksonExe {
private final static String path = "D:\\Programming\\java\\projects\\documents-parsing\\src\\resources\\json\\cats.json";
private final static String jsonUrl = "https://api.privatbank.ua/p24api/exchange_rates?json&date=01.04.2020";
public static void main(String[] args) {
ObjectMapper objectMapper = new ObjectMapper();
Cat[] cats = null;
public static Connection getConnection() throws SQLException, ClassNotFoundException {
Class.forName("org.postgresql.Driver");
return DriverManager.getConnection(PropertiesConfig.getProperty(PropertiesConfig.DB_URL),
PropertiesConfig.getProperty(PropertiesConfig.DB_LOGIN),
PropertiesConfig.getProperty(PropertiesConfig.DB_PASSWORD));
};
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("org.postgresql.Driver");
@EnableWebSecurity
public class JdbcSecurityConfiguration extends WebSecurityConfigurerAdapter {
...
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.jdbcAuthentication()
.dataSource(dataSource)
.passwordEncoder(passwordEncoder())
.usersByUsernameQuery(
########## ==== H2 ==== ############
spring.jpa.hibernate.ddl-auto = update
### ==== Database Credentials ==== ###
spring.datasource.url = jdbc:h2:mem:bh_workouts_postgres_2
spring.datasource.username = sa
spring.datasource.password =
### ==== Driver ==== ###
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/")
.permitAll()
.antMatchers("/login")
.permitAll()
.antMatchers("/registration")
FROM openjdk:11
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} sb-docker-1.jar
ENTRYPOINT ["java","-jar","/sb-docker-1.jar"]
quarkus.datasource.jdbc.url=jdbc:mariadb://localhost:3306/mydb
quarkus.datasource.db-kind=mariadb
quarkus.datasource.username=developer
quarkus.datasource.password=developer
quarkus.hibernate-orm.database.generation=update
FROM node:lts-alpine as build
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
COPY server/nginx.conf /etc/nginx/conf.d/default.conf