diff --git a/src/main/java/org/dbms/configuration/JDBCConection.java b/src/main/java/org/dbms/configuration/JDBCConection.java new file mode 100644 index 0000000..9e56676 --- /dev/null +++ b/src/main/java/org/dbms/configuration/JDBCConection.java @@ -0,0 +1,23 @@ +package org.dbms.configuration; + +import java.sql.Connection; +import java.sql.SQLException; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.core.JdbcTemplate; + +@Configuration +public class JDBCConection { + + @Bean + public Connection getConnection(JdbcTemplate jdbcTemplate) { + Connection connection = null; + try { + connection = jdbcTemplate.getDataSource().getConnection(); + } catch (SQLException e) { + e.printStackTrace(); + } + return connection; + } +} diff --git a/src/main/java/org/dbms/configuration/WebConfiguration.java b/src/main/java/org/dbms/configuration/WebConfiguration.java new file mode 100644 index 0000000..1e0d684 --- /dev/null +++ b/src/main/java/org/dbms/configuration/WebConfiguration.java @@ -0,0 +1,20 @@ +package org.dbms.configuration; + +import org.springframework.boot.web.server.ErrorPage; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +class WebConfiguration implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("*"); + } +} +