Merge pull request #9031 from Maiklins/JAVA-117-Standardize-tutorials-modules-packages-part2

Java 117 standardize spring boot modules
This commit is contained in:
Josh Cummings 2020-04-06 22:27:32 -06:00 committed by GitHub
commit f00294b0ad
81 changed files with 131 additions and 128 deletions

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;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -208,7 +208,7 @@
<properties>
<!-- The main class to start by executing java -jar -->
<start-class>org.baeldung.boot.Application</start-class>
<start-class>com.baeldung.boot.Application</start-class>
<jquery.version>3.1.1</jquery.version>
<bootstrap.version>3.3.7-1</bootstrap.version>
<jpa.version>2.2</jpa.version>

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.boot;
package com.baeldung.boot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.client;
package com.baeldung.boot.client;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.stereotype.Service;

View File

@ -1,4 +1,4 @@
package org.baeldung.websocket.client;
package com.baeldung.websocket.client;
public class Message {

View File

@ -1,4 +1,4 @@
package org.baeldung.websocket.client;
package com.baeldung.websocket.client;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

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

View File

@ -1,10 +1,12 @@
package org.baeldung.boot.client;
package com.baeldung.boot.client;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import org.baeldung.boot.Application;
import com.baeldung.boot.Application;
import com.baeldung.boot.client.Details;
import com.baeldung.boot.client.DetailsServiceClient;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,6 +1,5 @@
package com.baeldung.websocket.client;
import org.baeldung.websocket.client.MyStompSessionHandler;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.messaging.simp.stomp.StompHeaders;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
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

@ -190,7 +190,7 @@
<properties>
<!-- The main class to start by executing java -jar -->
<start-class>org.baeldung.boot.Application</start-class>
<start-class>com.baeldung.boot.Application</start-class>
<jquery.version>3.1.1</jquery.version>
<bootstrap.version>3.3.7-1</bootstrap.version>
<jpa.version>2.2</jpa.version>

View File

@ -21,7 +21,7 @@ apply plugin: 'io.spring.dependency-management'
//add tasks thinJar and thinResolve for thin JAR deployments
apply plugin: 'org.springframework.boot.experimental.thin-launcher'
group = 'org.baeldung'
group = 'com.baeldung'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
@ -35,16 +35,16 @@ dependencies {
}
springBoot {
mainClassName = 'org.baeldung.DemoApplication'
mainClassName = 'com.baeldung.DemoApplication'
}
bootJar {
// This is overridden by the mainClassName in springBoot{} and added here for reference purposes.
mainClassName = 'org.baeldung.DemoApplication'
mainClassName = 'com.baeldung.DemoApplication'
// This block serves the same purpose as the above thus commented out. Added here for reference purposes
// manifest {
// attributes 'Start-Class': 'org.baeldung.DemoApplication'
// attributes 'Start-Class': 'com.baeldung.DemoApplication'
// }
}

View File

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

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;
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;
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

@ -7,7 +7,7 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@Configuration
@ComponentScan("org.baeldung.properties.core")
@ComponentScan("com.baeldung.properties.core")
@PropertySource("classpath:foo.properties")
public class ExternalPropertiesWithJavaConfig {

View File

@ -6,7 +6,7 @@ import org.springframework.context.annotation.ImportResource;
@Configuration
@ImportResource("classpath:configForProperties.xml")
@ComponentScan("org.baeldung.core")
@ComponentScan("com.baeldung.core")
public class ExternalPropertiesWithXmlConfig {
public ExternalPropertiesWithXmlConfig() {

View File

@ -6,7 +6,7 @@ import org.springframework.context.annotation.ImportResource;
@Configuration
@ImportResource("classpath:configForPropertiesOne.xml")
@ComponentScan("org.baeldung.core")
@ComponentScan("com.baeldung.core")
public class ExternalPropertiesWithXmlConfigOne {
public ExternalPropertiesWithXmlConfigOne() {

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;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

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

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.config;
package com.baeldung.boot.config;
import java.util.Properties;
@ -18,7 +18,7 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableJpaRepositories(basePackages = { "org.baeldung.boot.repository", "org.baeldung.boot.boottest", "org.baeldung.repository" })
@EnableJpaRepositories(basePackages = { "com.baeldung.boot.repository", "com.baeldung.boot.boottest", "com.baeldung.repository" })
@PropertySource("classpath:persistence-generic-entity.properties")
@EnableTransactionManagement
public class H2JpaConfig {
@ -41,7 +41,7 @@ public class H2JpaConfig {
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "org.baeldung.boot.domain", "org.baeldung.boot.model", "org.baeldung.boot.boottest", "org.baeldung.model" });
em.setPackagesToScan(new String[] { "com.baeldung.boot.domain", "com.baeldung.boot.model", "com.baeldung.boot.boottest", "com.baeldung.model" });
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(additionalProperties());
return em;

View File

@ -1,8 +1,8 @@
package org.baeldung.boot.config;
package com.baeldung.boot.config;
import org.baeldung.boot.converter.StringToEmployeeConverter;
import org.baeldung.boot.converter.StringToEnumConverterFactory;
import org.baeldung.boot.converter.GenericBigDecimalConverter;
import com.baeldung.boot.converter.StringToEmployeeConverter;
import com.baeldung.boot.converter.StringToEnumConverterFactory;
import com.baeldung.boot.converter.GenericBigDecimalConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.controller.servlet;
package com.baeldung.boot.controller.servlet;
import java.io.IOException;
import java.io.PrintWriter;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.controller.servlet;
package com.baeldung.boot.controller.servlet;
import java.io.IOException;
import java.io.PrintWriter;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.converter;
package com.baeldung.boot.converter;
import com.google.common.collect.ImmutableSet;
import org.springframework.core.convert.TypeDescriptor;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.converter;
package com.baeldung.boot.converter;
import org.springframework.core.convert.converter.Converter;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.converter;
package com.baeldung.boot.converter;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterFactory;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.converter.controller;
package com.baeldung.boot.converter.controller;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package org.baeldung.boot.domain;
package com.baeldung.boot.domain;
public enum Modes {

View File

@ -1,4 +1,4 @@
package org.baeldung.common.error;
package com.baeldung.common.error;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package org.baeldung.common.error;
package com.baeldung.common.error;
import org.springframework.boot.web.servlet.ServletRegistrationBean;

View File

@ -1,4 +1,4 @@
package org.baeldung.common.error.controller;
package com.baeldung.common.error.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

View File

@ -1,4 +1,4 @@
package org.baeldung.common.properties;
package com.baeldung.common.properties;
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;

View File

@ -1,4 +1,4 @@
package org.baeldung.common.resources;
package com.baeldung.common.resources;
import org.springframework.boot.ExitCodeGenerator;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo;
package com.baeldung.demo;
import com.baeldung.graphql.GraphqlConfiguration;
import org.springframework.boot.SpringApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest;
package com.baeldung.demo.boottest;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;

View File

@ -1,7 +1,7 @@
package org.baeldung.demo.components;
package com.baeldung.demo.components;
import org.baeldung.demo.model.Foo;
import org.baeldung.demo.repository.FooRepository;
import com.baeldung.demo.model.Foo;
import com.baeldung.demo.repository.FooRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.exceptions;
package com.baeldung.demo.exceptions;
public class CommonException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.exceptions;
package com.baeldung.demo.exceptions;
public class FooNotFoundException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.model;
package com.baeldung.demo.model;
import java.io.Serializable;

View File

@ -1,6 +1,6 @@
package org.baeldung.demo.repository;
package com.baeldung.demo.repository;
import org.baeldung.demo.model.Foo;
import com.baeldung.demo.model.Foo;
import org.springframework.data.jpa.repository.JpaRepository;
public interface FooRepository extends JpaRepository<Foo, Integer> {

View File

@ -1,7 +1,7 @@
package org.baeldung.demo.service;
package com.baeldung.demo.service;
import org.baeldung.demo.components.FooService;
import org.baeldung.demo.model.Foo;
import com.baeldung.demo.model.Foo;
import com.baeldung.demo.components.FooService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

View File

@ -1,9 +1,9 @@
package org.baeldung.endpoints.info;
package com.baeldung.endpoints.info;
import java.util.HashMap;
import java.util.Map;
import org.baeldung.repository.UserRepository;
import com.baeldung.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;

View File

@ -1,9 +1,9 @@
package org.baeldung.main;
package com.baeldung.main;
import org.baeldung.boot.controller.servlet.HelloWorldServlet;
import org.baeldung.boot.controller.servlet.SpringHelloWorldServlet;
import org.baeldung.common.error.SpringHelloServletRegistrationBean;
import org.baeldung.common.resources.ExecutorServiceExitCodeGenerator;
import com.baeldung.boot.controller.servlet.HelloWorldServlet;
import com.baeldung.boot.controller.servlet.SpringHelloWorldServlet;
import com.baeldung.common.error.SpringHelloServletRegistrationBean;
import com.baeldung.common.resources.ExecutorServiceExitCodeGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -18,7 +18,7 @@ import java.util.concurrent.Executors;
@RestController
@EnableAutoConfiguration
@ComponentScan({ "org.baeldung.common.error", "org.baeldung.common.error.controller", "org.baeldung.common.properties", "org.baeldung.common.resources", "org.baeldung.endpoints", "org.baeldung.service", "org.baeldung.monitor.jmx", "org.baeldung.boot.config" })
@ComponentScan({ "com.baeldung.common.error", "com.baeldung.common.error.controller", "com.baeldung.common.properties", "com.baeldung.common.resources", "com.baeldung.endpoints", "com.baeldung.service", "com.baeldung.monitor.jmx", "com.baeldung.boot.config" })
public class SpringBootApplication {
private static ApplicationContext applicationContext;

View File

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

View File

@ -1,6 +1,6 @@
package org.baeldung.repository;
package com.baeldung.repository;
import org.baeldung.model.User;
import com.baeldung.model.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

View File

@ -1,6 +1,6 @@
package org.baeldung.session.exception;
package com.baeldung.session.exception;
import org.baeldung.demo.model.Foo;
import com.baeldung.demo.model.Foo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;

View File

@ -1,6 +1,6 @@
package org.baeldung.session.exception.repository;
package com.baeldung.session.exception.repository;
import org.baeldung.demo.model.Foo;
import com.baeldung.demo.model.Foo;
public interface FooRepository {

View File

@ -1,8 +1,8 @@
package org.baeldung.session.exception.repository;
package com.baeldung.session.exception.repository;
import javax.persistence.EntityManagerFactory;
import org.baeldung.demo.model.Foo;
import com.baeldung.demo.model.Foo;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
package org.baeldung.boot.repository;
package com.baeldung.boot.repository;
import org.baeldung.boot.DemoApplicationIntegrationTest;
import org.baeldung.demo.model.Foo;
import org.baeldung.demo.repository.FooRepository;
import com.baeldung.boot.DemoApplicationIntegrationTest;
import com.baeldung.demo.model.Foo;
import com.baeldung.demo.repository.FooRepository;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,8 +1,8 @@
package org.baeldung.boot.repository;
package com.baeldung.boot.repository;
import org.baeldung.boot.DemoApplicationIntegrationTest;
import org.baeldung.demo.model.Foo;
import org.baeldung.demo.repository.FooRepository;
import com.baeldung.boot.DemoApplicationIntegrationTest;
import com.baeldung.demo.model.Foo;
import com.baeldung.demo.repository.FooRepository;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,8 +1,8 @@
package org.baeldung.boot.repository;
package com.baeldung.boot.repository;
import org.baeldung.boot.ApplicationIntegrationTest;
import org.baeldung.demo.model.Foo;
import org.baeldung.session.exception.repository.FooRepository;
import com.baeldung.boot.ApplicationIntegrationTest;
import com.baeldung.demo.model.Foo;
import com.baeldung.session.exception.repository.FooRepository;
import org.hibernate.HibernateException;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,9 +1,9 @@
package org.baeldung.converter;
package com.baeldung.converter;
import com.baeldung.toggle.Employee;
import org.baeldung.boot.Application;
import org.baeldung.boot.domain.Modes;
import com.baeldung.boot.Application;
import com.baeldung.boot.domain.Modes;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package org.baeldung.converter.controller;
package com.baeldung.converter.controller;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -14,7 +14,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.baeldung.boot.Application;
import com.baeldung.boot.Application;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = Application.class)

View File

@ -1,8 +1,5 @@
package org.baeldung.demo.boottest;
package com.baeldung.demo.boottest;
import org.baeldung.demo.boottest.Employee;
import org.baeldung.demo.boottest.EmployeeRestController;
import org.baeldung.demo.boottest.EmployeeService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,7 +1,7 @@
package org.baeldung.demo.boottest;
package com.baeldung.demo.boottest;
import org.baeldung.demo.boottest.Employee;
import org.baeldung.demo.boottest.EmployeeRepository;
import com.baeldung.demo.boottest.Employee;
import com.baeldung.demo.boottest.EmployeeRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest;
package com.baeldung.demo.boottest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.is;
@ -14,7 +14,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import java.io.IOException;
import java.util.List;
import org.baeldung.demo.DemoApplication;
import com.baeldung.demo.DemoApplication;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest;
package com.baeldung.demo.boottest;
import static org.assertj.core.api.Assertions.assertThat;
@ -6,6 +6,10 @@ import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import com.baeldung.demo.boottest.Employee;
import com.baeldung.demo.boottest.EmployeeRepository;
import com.baeldung.demo.boottest.EmployeeService;
import com.baeldung.demo.boottest.EmployeeServiceImpl;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest;
package com.baeldung.demo.boottest;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;

View File

@ -1,7 +1,8 @@
package org.baeldung.repository;
package com.baeldung.repository;
import org.baeldung.boot.config.H2JpaConfig;
import org.baeldung.model.User;
import com.baeldung.boot.config.H2JpaConfig;
import com.baeldung.model.User;
import com.baeldung.repository.UserRepository;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;