JAVA-117 Standardize spring-boot-modules/spring-boot

This commit is contained in:
mikr 2020-04-04 20:24:48 +02:00
parent 1699e86ef9
commit 487d6b38fc
49 changed files with 93 additions and 91 deletions

View File

@ -1,4 +1,4 @@
package org.baeldung.boot; package com.baeldung.boot;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; 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; import java.util.Properties;
@ -18,7 +18,7 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration @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") @PropertySource("classpath:persistence-generic-entity.properties")
@EnableTransactionManagement @EnableTransactionManagement
public class H2JpaConfig { public class H2JpaConfig {
@ -41,7 +41,7 @@ public class H2JpaConfig {
public LocalContainerEntityManagerFactoryBean entityManagerFactory() { public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource()); 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.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(additionalProperties()); em.setJpaProperties(additionalProperties());
return em; 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 com.baeldung.boot.converter.StringToEmployeeConverter;
import org.baeldung.boot.converter.StringToEnumConverterFactory; import com.baeldung.boot.converter.StringToEnumConverterFactory;
import org.baeldung.boot.converter.GenericBigDecimalConverter; import com.baeldung.boot.converter.GenericBigDecimalConverter;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry; import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 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.IOException;
import java.io.PrintWriter; 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.IOException;
import java.io.PrintWriter; 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 com.google.common.collect.ImmutableSet;
import org.springframework.core.convert.TypeDescriptor; 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; 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.Converter;
import org.springframework.core.convert.converter.ConverterFactory; 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.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; 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 { 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.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.GetMapping; 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; 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.GetMapping;
import org.springframework.web.bind.annotation.RestController; 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.ErrorPage;
import org.springframework.boot.web.server.WebServerFactoryCustomizer; 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; 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 com.baeldung.graphql.GraphqlConfiguration;
import org.springframework.boot.SpringApplication; 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.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest; package com.baeldung.demo.boottest;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest; package com.baeldung.demo.boottest;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest; package com.baeldung.demo.boottest;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.baeldung.demo.boottest; package com.baeldung.demo.boottest;
import java.util.List; import java.util.List;

View File

@ -1,7 +1,7 @@
package org.baeldung.demo.components; package com.baeldung.demo.components;
import org.baeldung.demo.model.Foo; import com.baeldung.demo.model.Foo;
import org.baeldung.demo.repository.FooRepository; import com.baeldung.demo.repository.FooRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; 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 { 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 { 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; 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; import org.springframework.data.jpa.repository.JpaRepository;
public interface FooRepository extends JpaRepository<Foo, Integer> { 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 com.baeldung.demo.model.Foo;
import org.baeldung.demo.model.Foo; import com.baeldung.demo.components.FooService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; 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.HashMap;
import java.util.Map; import java.util.Map;
import org.baeldung.repository.UserRepository; import com.baeldung.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.info.Info; import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor; 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 com.baeldung.boot.controller.servlet.HelloWorldServlet;
import org.baeldung.boot.controller.servlet.SpringHelloWorldServlet; import com.baeldung.boot.controller.servlet.SpringHelloWorldServlet;
import org.baeldung.common.error.SpringHelloServletRegistrationBean; import com.baeldung.common.error.SpringHelloServletRegistrationBean;
import org.baeldung.common.resources.ExecutorServiceExitCodeGenerator; import com.baeldung.common.resources.ExecutorServiceExitCodeGenerator;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -18,7 +18,7 @@ import java.util.concurrent.Executors;
@RestController @RestController
@EnableAutoConfiguration @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({ "org.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 { public class SpringBootApplication {
private static ApplicationContext applicationContext; 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.Entity;
import javax.persistence.GeneratedValue; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; 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.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan; 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 { 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 javax.persistence.EntityManagerFactory;
import org.baeldung.demo.model.Foo; import com.baeldung.demo.model.Foo;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile; 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.Logger;
import org.slf4j.LoggerFactory; 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.Logger;
import org.slf4j.LoggerFactory; 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.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

@ -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.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

@ -1,8 +1,8 @@
package org.baeldung.boot.repository; package com.baeldung.boot.repository;
import org.baeldung.boot.DemoApplicationIntegrationTest; import com.baeldung.boot.DemoApplicationIntegrationTest;
import org.baeldung.demo.model.Foo; import com.baeldung.demo.model.Foo;
import org.baeldung.demo.repository.FooRepository; import com.baeldung.demo.repository.FooRepository;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; 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 com.baeldung.boot.DemoApplicationIntegrationTest;
import org.baeldung.demo.model.Foo; import com.baeldung.demo.model.Foo;
import org.baeldung.demo.repository.FooRepository; import com.baeldung.demo.repository.FooRepository;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; 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 com.baeldung.boot.ApplicationIntegrationTest;
import org.baeldung.demo.model.Foo; import com.baeldung.demo.model.Foo;
import org.baeldung.session.exception.repository.FooRepository; import com.baeldung.session.exception.repository.FooRepository;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; 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 com.baeldung.toggle.Employee;
import org.baeldung.boot.Application; import com.baeldung.boot.Application;
import org.baeldung.boot.domain.Modes; import com.baeldung.boot.domain.Modes;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; 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.Test;
import org.junit.runner.RunWith; 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.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.baeldung.boot.Application; import com.baeldung.boot.Application;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = Application.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.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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 com.baeldung.demo.boottest.Employee;
import org.baeldung.demo.boottest.EmployeeRepository; import com.baeldung.demo.boottest.EmployeeRepository;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; 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.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.is; 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.io.IOException;
import java.util.List; import java.util.List;
import org.baeldung.demo.DemoApplication; import com.baeldung.demo.DemoApplication;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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; import static org.assertj.core.api.Assertions.assertThat;
@ -6,6 +6,10 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; 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.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper; 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 com.baeldung.boot.config.H2JpaConfig;
import org.baeldung.model.User; import com.baeldung.model.User;
import com.baeldung.repository.UserRepository;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;