Merge pull request #8914 from kwoyke/JAVA-960

JAVA-960: Standardize packages in remaining spring-* modules
This commit is contained in:
Josh Cummings 2020-03-21 11:29:32 -06:00 committed by GitHub
commit 34022166be
55 changed files with 93 additions and 120 deletions

View File

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

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate.configuration;
package com.baeldung.resttemplate.configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate.configuration;
package com.baeldung.resttemplate.configuration;
import org.springframework.boot.web.client.RestTemplateCustomizer;
import org.springframework.web.client.RestTemplate;

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate.configuration;
package com.baeldung.resttemplate.configuration;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
@ -6,7 +6,7 @@ import java.net.URI;
import java.util.Collection;
import java.util.Map;
import org.baeldung.resttemplate.web.dto.Foo;
import com.baeldung.resttemplate.web.dto.Foo;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate.configuration;
package com.baeldung.resttemplate.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate.configuration;
package com.baeldung.resttemplate.configuration;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -11,7 +11,7 @@ import org.springframework.web.client.RestTemplate;
@Configuration
@EnableAutoConfiguration
@ComponentScan("org.baeldung.resttemplate.configuration")
@ComponentScan("com.baeldung.resttemplate.configuration")
public class SpringConfig {
@Bean
@ -26,8 +26,4 @@ public class SpringConfig {
return new RestTemplateBuilder(customRestTemplateCustomizer());
}
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}

View File

@ -7,7 +7,7 @@ import com.baeldung.resttemplate.lists.dto.Employee;
import java.util.ArrayList;
import java.util.List;
@Service
@Service("EmployeeListService")
public class EmployeeService
{
public List<Employee> getAllEmployees()

View File

@ -1,9 +1,9 @@
package org.baeldung.resttemplate.web.controller;
package com.baeldung.resttemplate.web.controller;
import javax.servlet.http.HttpServletResponse;
import org.baeldung.resttemplate.web.dto.Person;
import org.baeldung.resttemplate.web.service.PersonService;
import com.baeldung.resttemplate.web.service.PersonService;
import com.baeldung.resttemplate.web.dto.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

View File

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

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate.web.dto;
package com.baeldung.resttemplate.web.dto;
public class Person {
private Integer id;

View File

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

View File

@ -1,8 +1,8 @@
package org.baeldung.resttemplate.web.handler;
package com.baeldung.resttemplate.web.handler;
import java.io.IOException;
import org.baeldung.resttemplate.web.exception.NotFoundException;
import com.baeldung.resttemplate.web.exception.NotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.stereotype.Component;

View File

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

View File

@ -1,6 +1,5 @@
package org.baeldung.resttemplate.web.model;
package com.baeldung.resttemplate.web.model;
import java.util.Date;
import java.util.Objects;
public class Employee {

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package org.baeldung.resttemplate.web.service;
package com.baeldung.resttemplate.web.service;
import org.baeldung.resttemplate.web.dto.Person;
import com.baeldung.resttemplate.web.dto.Person;
public interface PersonService {

View File

@ -1,6 +1,6 @@
package org.baeldung.resttemplate.web.service;
package com.baeldung.resttemplate.web.service;
import org.baeldung.resttemplate.web.dto.Person;
import com.baeldung.resttemplate.web.dto.Person;
import org.springframework.stereotype.Component;
@Component

View File

@ -20,7 +20,7 @@ import com.baeldung.sampleapp.web.dto.Foo;
import com.baeldung.sampleapp.web.exception.ResourceNotFoundException;
@Controller
@RequestMapping(value = "/foos")
@RequestMapping(value = "/foo")
public class MyFooController {
private final Map<Long, Foo> myfoos;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
@ -8,12 +8,7 @@ import org.springframework.web.client.RestTemplate;
@Configuration
@EnableAutoConfiguration
@ComponentScan("org.baeldung")
@ComponentScan("com.baeldung")
public class SpringTestConfig {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}

View File

@ -1,4 +1,4 @@
package org.baeldung.client;
package com.baeldung.client;
public interface Consts {
int APPLICATION_PORT = 8082;

View File

@ -1,10 +1,10 @@
package org.baeldung.client;
package com.baeldung.client;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;
import org.baeldung.resttemplate.web.dto.Foo;
import com.baeldung.resttemplate.web.dto.Foo;
import org.junit.Before;
import org.junit.Test;
import org.springframework.boot.test.web.client.TestRestTemplate;

View File

@ -1,4 +1,4 @@
package org.baeldung.resttemplate;
package com.baeldung.resttemplate;
import org.assertj.core.api.Assertions;
import org.junit.Assert;

View File

@ -1,7 +1,7 @@
package org.baeldung.resttemplate;
package com.baeldung.resttemplate;
import static org.apache.commons.codec.binary.Base64.encodeBase64;
import static org.baeldung.client.Consts.APPLICATION_PORT;
import static com.baeldung.client.Consts.APPLICATION_PORT;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
@ -14,8 +14,8 @@ import java.net.URI;
import java.util.Arrays;
import java.util.Set;
import org.baeldung.resttemplate.web.dto.Foo;
import org.baeldung.resttemplate.web.handler.RestTemplateResponseErrorHandler;
import com.baeldung.resttemplate.web.handler.RestTemplateResponseErrorHandler;
import com.baeldung.resttemplate.web.dto.Foo;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.HttpEntity;

View File

@ -1,12 +1,12 @@
package org.baeldung.resttemplate.postjson;
package com.baeldung.resttemplate.postjson;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.net.URI;
import org.baeldung.resttemplate.RestTemplateConfigurationApplication;
import org.baeldung.resttemplate.web.dto.Person;
import com.baeldung.resttemplate.RestTemplateConfigurationApplication;
import com.baeldung.resttemplate.web.dto.Person;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.BeforeClass;

View File

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

View File

@ -1,4 +1,4 @@
package org.baeldung.web.service;
package com.baeldung.web.service;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
@ -6,9 +6,9 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
import java.net.URI;
import org.baeldung.SpringTestConfig;
import org.baeldung.resttemplate.web.model.Employee;
import org.baeldung.resttemplate.web.service.EmployeeService;
import com.baeldung.SpringTestConfig;
import com.baeldung.resttemplate.web.model.Employee;
import com.baeldung.resttemplate.web.service.EmployeeService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -16,6 +16,7 @@ import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -28,7 +29,7 @@ import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = SpringTestConfig.class)
@SpringBootTest(classes = SpringTestConfig.class)
public class EmployeeServiceMockRestServiceServerUnitTest {
private static final Logger logger = LoggerFactory.getLogger(EmployeeServiceMockRestServiceServerUnitTest.class);

View File

@ -1,15 +1,13 @@
package org.baeldung.web.service;
package com.baeldung.web.service;
import org.baeldung.resttemplate.web.model.Employee;
import org.baeldung.resttemplate.web.service.EmployeeService;
import com.baeldung.resttemplate.web.model.Employee;
import com.baeldung.resttemplate.web.service.EmployeeService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,16 +0,0 @@
package org.baeldung;
import org.baeldung.resttemplate.RestTemplateConfigurationApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RestTemplateConfigurationApplication.class)
public class SpringContextTest {
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
}
}

View File

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId>
<groupId>com.baeldung</groupId>
<artifactId>spring-session</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>spring-session</name>

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import com.baeldung.springsessionmongodb.SpringSessionMongoDBApplication;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung.config;
package com.baeldung.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -7,8 +7,8 @@ import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EnableJpaRepositories("org.baeldung.persistence.dao")
@EntityScan("org.baeldung.persistence.model")
@EnableJpaRepositories("com.baeldung.persistence.dao")
@EntityScan("com.baeldung.persistence.model")
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {

View File

@ -1,7 +1,7 @@
package org.baeldung.config;
package com.baeldung.config;
import org.baeldung.security.FacebookSignInAdapter;
import org.baeldung.security.FacebookConnectionSignup;
import com.baeldung.security.FacebookSignInAdapter;
import com.baeldung.security.FacebookConnectionSignup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -18,7 +18,7 @@ import org.springframework.social.connect.web.ProviderSignInController;
@Configuration
@EnableWebSecurity
@ComponentScan(basePackages = { "org.baeldung.security" })
@ComponentScan(basePackages = { "com.baeldung.security" })
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired

View File

@ -1,4 +1,4 @@
package org.baeldung.config;
package com.baeldung.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,6 +1,6 @@
package org.baeldung.persistence.dao;
package com.baeldung.persistence.dao;
import org.baeldung.persistence.model.User;
import com.baeldung.persistence.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepository extends JpaRepository<User, Long> {

View File

@ -1,4 +1,4 @@
package org.baeldung.persistence.model;
package com.baeldung.persistence.model;
import javax.persistence.Column;
import javax.persistence.Entity;

View File

@ -1,9 +1,9 @@
package org.baeldung.security;
package com.baeldung.security;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import org.baeldung.persistence.dao.UserRepository;
import org.baeldung.persistence.model.User;
import com.baeldung.persistence.dao.UserRepository;
import com.baeldung.persistence.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.social.connect.Connection;
import org.springframework.social.connect.ConnectionSignUp;

View File

@ -1,4 +1,4 @@
package org.baeldung.security;
package com.baeldung.security;
import java.util.Arrays;

View File

@ -1,9 +1,9 @@
package org.baeldung.security;
package com.baeldung.security;
import java.util.Arrays;
import org.baeldung.persistence.dao.UserRepository;
import org.baeldung.persistence.model.User;
import com.baeldung.persistence.dao.UserRepository;
import com.baeldung.persistence.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

View File

@ -1,6 +1,6 @@
package org.baeldung;
package com.baeldung;
import org.baeldung.config.Application;
import com.baeldung.config.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung.security;
package com.baeldung.security;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring;
package com.baeldung.spring;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -8,7 +8,7 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@Configuration
@ComponentScan(basePackages = { "org.baeldung.persistence.service", "org.baeldung.persistence.dao" })
@ComponentScan(basePackages = { "com.baeldung.persistence.service", "com.baeldung.persistence.dao" })
@Import({ MvcConfig.class, SecSecurityConfig.class })
@PropertySource("classpath:application.properties")
public class AppConfig {

View File

@ -1,4 +1,4 @@
package org.baeldung.spring;
package com.baeldung.spring;
import java.util.Locale;
@ -25,7 +25,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
@Configuration
@ComponentScan(basePackages = { "org.baeldung.web.controller", "org.baeldung.persistence.service", "org.baeldung.persistence.dao" })
@ComponentScan(basePackages = { "com.baeldung.web.controller", "com.baeldung.persistence.service", "com.baeldung.persistence.dao" })
@EnableWebMvc
public class MvcConfig implements WebMvcConfigurer {
@Autowired

View File

@ -1,4 +1,4 @@
package org.baeldung.spring;
package com.baeldung.spring;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import java.io.IOException;
import java.text.DateFormat;

View File

@ -23,7 +23,7 @@
<security:logout invalidate-session="false" logout-success-url="/logout.html?logSucc=true" delete-cookies="JSESSIONID"/>
</security:http>
<bean id="myAuthenticationSuccessHandler" class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler"/>
<bean id="myAuthenticationSuccessHandler" class="com.baeldung.security.MySimpleUrlAuthenticationSuccessHandler"/>
<security:authentication-manager>
<security:authentication-provider>

View File

@ -1,6 +1,6 @@
package com.baeldung;
import org.baeldung.spring.SecSecurityConfig;
import com.baeldung.spring.SecSecurityConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;