файлы конфигурации
This commit is contained in:
parent
8824130025
commit
0a0686973e
23
src/main/java/org/dbms/configuration/JDBCConection.java
Normal file
23
src/main/java/org/dbms/configuration/JDBCConection.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
20
src/main/java/org/dbms/configuration/WebConfiguration.java
Normal file
20
src/main/java/org/dbms/configuration/WebConfiguration.java
Normal file
@ -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("*");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user