diff options
Diffstat (limited to 'sliapi/springboot/src/main')
4 files changed, 21 insertions, 46 deletions
diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java index cf8dc5e37..0c8480e11 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java @@ -64,12 +64,14 @@ public class SvcLogicFactory { public Properties getProperties() {
Properties props = new Properties();
+
String propPath = System.getProperty("serviceLogicProperties", "");
if ("".equals(propPath)) {
propPath = System.getenv("SVCLOGIC_PROPERTIES");
}
+
if ((propPath == null) || propPath.length() == 0) {
propPath = "src/main/resources/svclogic.properties";
}
diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java index 41d3791b4..558a82a11 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java @@ -21,11 +21,14 @@ package org.onap.ccsdk.sli.core.sliapi.springboot.core;
import org.onap.logging.filter.spring.LoggingInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.orm.jpa.JpaTransactionManager;
@@ -48,43 +51,5 @@ import javax.sql.DataSource; @EnableTransactionManagement
public class WebConfig implements WebMvcConfigurer {
-/* @Bean
- LoggingInterceptor loggingInterceptor() {
- return new LoggingInterceptor();
- }
- public void addInterceptors(InterceptorRegistry registry) {
- registry.addInterceptor(loggingInterceptor()); // handles audit log entries
- }*/
-
- @Bean
- public DataSource dataSource() {
-
- EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
- builder.setName("sdnctl");
- return builder.setType(EmbeddedDatabaseType.DERBY).build();
- }
-
- @Bean
- public EntityManagerFactory entityManagerFactory() {
-
- HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
- vendorAdapter.setGenerateDdl(true);
-
- LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
- factory.setJpaVendorAdapter(vendorAdapter);
- factory.setPackagesToScan("org.onap.ccsdk.sli.core.sliapi.springboot.*");
- factory.setDataSource(dataSource());
- factory.afterPropertiesSet();
-
- return factory.getObject();
- }
-
- @Bean
- public PlatformTransactionManager transactionManager() {
-
- JpaTransactionManager txManager = new JpaTransactionManager();
- txManager.setEntityManagerFactory(entityManagerFactory());
- return txManager;
- }
}
\ No newline at end of file diff --git a/sliapi/springboot/src/main/resources/application.properties b/sliapi/springboot/src/main/resources/application.properties index 6a4acc7e9..f083ed5e9 100644 --- a/sliapi/springboot/src/main/resources/application.properties +++ b/sliapi/springboot/src/main/resources/application.properties @@ -3,8 +3,16 @@ server.contextPath=/restconf server.port=8080 spring.jackson.date-format=org.onap.ccsdk.sli.core.sliapi.springboot.controllers.swagger.RFC3339DateFormat spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false -spring.datasource.url=jdbc:derby:memory:datasource -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect -spring.jpa.hibernate.ddl-auto=update logging.level.com.att=TRACE -logging.level.org.onap=TRACE
\ No newline at end of file +logging.level.org.onap=TRACE +spring.datasource.url=jdbc:mariadb://localhost:3306/sdnctl +spring.datasource.username=sli +spring.datasource.password=abc123 +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.datasource.testWhileIdle=true +spring.datasource.validationQuery=SELECT 1 +spring.jpa.show-sql=true +spring.jpa.hibernate.ddl-auto=update +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy +spring.jpa.database=mysql
\ No newline at end of file diff --git a/sliapi/springboot/src/main/resources/svclogic.properties b/sliapi/springboot/src/main/resources/svclogic.properties index 1d90ab9b4..ae396adde 100644 --- a/sliapi/springboot/src/main/resources/svclogic.properties +++ b/sliapi/springboot/src/main/resources/svclogic.properties @@ -20,10 +20,10 @@ ### org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true -org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +org.onap.ccsdk.sli.jdbc.url=jdbc:mariadb://localhost:3306/sdnctl +org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver org.onap.ccsdk.sli.jdbc.database = sdnctl -org.onap.ccsdk.sli.jdbc.user = test -org.onap.ccsdk.sli.jdbc.password = test +org.onap.ccsdk.sli.jdbc.user = sli +org.onap.ccsdk.sli.jdbc.password = abc123 sliapi.serviceLogicDirectory=/opt/onap/sdnc/svclogic/graphs |