[BAEL-10982] - Fixed application startup

This commit is contained in:
amit2103 2019-03-17 00:28:43 +05:30
parent 6ad4766776
commit 70736ee16a
15 changed files with 30 additions and 18 deletions

View File

@ -25,6 +25,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate.configuration; package org.baeldung.resttemplate;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

View File

@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.DependsOn;
import org.springframework.web.client.RestTemplate;
@Configuration @Configuration
@EnableAutoConfiguration @EnableAutoConfiguration
@ -25,4 +26,8 @@ public class SpringConfig {
return new RestTemplateBuilder(customRestTemplateCustomizer()); return new RestTemplateBuilder(customRestTemplateCustomizer());
} }
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
} }

View File

@ -1,4 +1,4 @@
package org.baeldung.web.dto; package org.baeldung.resttemplate.web.dto;
import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAlias;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.exception; package org.baeldung.resttemplate.web.exception;
public class NotFoundException extends RuntimeException { public class NotFoundException extends RuntimeException {
} }

View File

@ -1,6 +1,6 @@
package org.baeldung.web.handler; package org.baeldung.resttemplate.web.handler;
import org.baeldung.web.exception.NotFoundException; import org.baeldung.resttemplate.web.exception.NotFoundException;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.ClientHttpResponse;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.model; package org.baeldung.resttemplate.web.model;
public class Bar { public class Bar {
private String id; private String id;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.model; package org.baeldung.resttemplate.web.model;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;

View File

@ -1,7 +1,7 @@
package org.baeldung.web.service; package org.baeldung.resttemplate.web.service;
import org.baeldung.web.handler.RestTemplateResponseErrorHandler; import org.baeldung.resttemplate.web.handler.RestTemplateResponseErrorHandler;
import org.baeldung.web.model.Bar; import org.baeldung.resttemplate.web.model.Bar;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@ -1,6 +1,6 @@
package org.baeldung.web.service; package org.baeldung.resttemplate.web.service;
import org.baeldung.web.model.Employee; import org.baeldung.resttemplate.web.model.Employee;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,6 +1,6 @@
package org.baeldung; package org.baeldung;
import org.baeldung.resttemplate.configuration.RestTemplateConfigurationApplication; import org.baeldung.resttemplate.RestTemplateConfigurationApplication;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;

View File

@ -14,7 +14,7 @@ import java.net.URI;
import java.util.Arrays; import java.util.Arrays;
import java.util.Set; import java.util.Set;
import org.baeldung.web.dto.Foo; import org.baeldung.resttemplate.web.dto.Foo;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;

View File

@ -1,7 +1,8 @@
package org.baeldung.web.handler; package org.baeldung.web.handler;
import org.baeldung.web.exception.NotFoundException; import org.baeldung.resttemplate.web.exception.NotFoundException;
import org.baeldung.web.model.Bar; import org.baeldung.resttemplate.web.handler.RestTemplateResponseErrorHandler;
import org.baeldung.resttemplate.web.model.Bar;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@ -7,7 +7,8 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
import java.net.URI; import java.net.URI;
import org.baeldung.SpringTestConfig; import org.baeldung.SpringTestConfig;
import org.baeldung.web.model.Employee; import org.baeldung.resttemplate.web.model.Employee;
import org.baeldung.resttemplate.web.service.EmployeeService;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;

View File

@ -1,6 +1,7 @@
package org.baeldung.web.service; package org.baeldung.web.service;
import org.baeldung.web.model.Employee; import org.baeldung.resttemplate.web.model.Employee;
import org.baeldung.resttemplate.web.service.EmployeeService;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;