From 1293f4e17232fd39d3eb5dd97b141bd98b934533 Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 25 Jan 2019 22:40:12 +0200 Subject: [PATCH] update boot dependencies, config --- spring-boot-rest/pom.xml | 27 ++++---------- .../baeldung/spring/PersistenceConfig.java | 1 - .../java/com/baeldung/spring/WebConfig.java | 35 +------------------ .../resources/springDataPersistenceConfig.xml | 12 ------- 4 files changed, 7 insertions(+), 68 deletions(-) delete mode 100644 spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index bcd0381603..cf4ac0371b 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -25,31 +25,16 @@ com.fasterxml.jackson.dataformat jackson-dataformat-xml - - org.hibernate - hibernate-entitymanager - - - org.springframework - spring-jdbc - - - org.springframework.data - spring-data-jpa - + com.h2database h2 - - org.springframework - spring-tx - - - org.springframework.data - spring-data-commons - - + + org.springframework.boot + spring-boot-starter-data-jpa + + diff --git a/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java b/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java index 4a4b9eee3f..5179c66978 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java +++ b/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java @@ -25,7 +25,6 @@ import com.google.common.base.Preconditions; @EnableTransactionManagement @PropertySource({ "classpath:persistence-${envTarget:h2}.properties" }) @ComponentScan({ "com.baeldung.persistence" }) -// @ImportResource("classpath*:springDataPersistenceConfig.xml") @EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao") public class PersistenceConfig { diff --git a/spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java b/spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java index 39aade174b..80ee975e84 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java +++ b/spring-boot-rest/src/main/java/com/baeldung/spring/WebConfig.java @@ -1,43 +1,10 @@ package com.baeldung.spring; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.http.MediaType; -import org.springframework.web.servlet.ViewResolver; -import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.springframework.web.servlet.view.InternalResourceViewResolver; + @Configuration -@ComponentScan("com.baeldung.web") -@EnableWebMvc public class WebConfig implements WebMvcConfigurer { - public WebConfig() { - super(); - } - - @Bean - public ViewResolver viewResolver() { - final InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); - viewResolver.setPrefix("/WEB-INF/view/"); - viewResolver.setSuffix(".jsp"); - return viewResolver; - } - - // API - @Override - public void addViewControllers(final ViewControllerRegistry registry) { - registry.addViewController("/graph.html"); - registry.addViewController("/homepage.html"); - } - - @Override - public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { - configurer.defaultContentType(MediaType.APPLICATION_JSON); - } - } \ No newline at end of file diff --git a/spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml b/spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml deleted file mode 100644 index 5ea2d9c05b..0000000000 --- a/spring-boot-rest/src/main/resources/springDataPersistenceConfig.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file