Merge pull request #6217 from eugenp/boot-rest-update
update boot dependencies, config
This commit is contained in:
commit
86aafa3976
|
@ -25,29 +25,14 @@
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-xml</artifactId>
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.hibernate</groupId>
|
|
||||||
<artifactId>hibernate-entitymanager</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-jdbc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.data</groupId>
|
|
||||||
<artifactId>spring-data-jpa</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-tx</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.data</groupId>
|
|
||||||
<artifactId>spring-data-commons</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- util -->
|
<!-- util -->
|
||||||
|
|
|
@ -25,7 +25,6 @@ import com.google.common.base.Preconditions;
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" })
|
@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" })
|
||||||
@ComponentScan({ "com.baeldung.persistence" })
|
@ComponentScan({ "com.baeldung.persistence" })
|
||||||
// @ImportResource("classpath*:springDataPersistenceConfig.xml")
|
|
||||||
@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao")
|
@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao")
|
||||||
public class PersistenceConfig {
|
public class PersistenceConfig {
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,10 @@
|
||||||
package com.baeldung.spring;
|
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.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.config.annotation.WebMvcConfigurer;
|
||||||
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan("com.baeldung.web")
|
|
||||||
@EnableWebMvc
|
|
||||||
public class WebConfig implements WebMvcConfigurer {
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
|
|
||||||
xsi:schemaLocation="
|
|
||||||
http://www.springframework.org/schema/beans
|
|
||||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
|
||||||
http://www.springframework.org/schema/data/jpa
|
|
||||||
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"
|
|
||||||
>
|
|
||||||
|
|
||||||
<jpa:repositories base-package="com.baeldung.persistence.dao"/>
|
|
||||||
|
|
||||||
</beans>
|
|
Loading…
Reference in New Issue