BAEL-20869 Move remaining spring boot modules

This commit is contained in:
mikr
2020-02-02 20:44:54 +01:00
parent 80a2cfec65
commit 56a9403564
704 changed files with 1303 additions and 1501 deletions

View File

@@ -0,0 +1,54 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
group = 'com.baeldung'
version = '0.0.1-SNAPSHOT'
description = """spring-boot"""
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
}
springBoot {
executable = true
}
import org.apache.tools.ant.filters.ReplaceTokens
processResources {
with copySpec {
from 'src/main/resources'
include '**/application*.yml'
include '**/application*.yaml'
include '**/application*.properties'
project.properties.findAll().each { prop ->
if (prop.value != null) {
filter(ReplaceTokens, tokens: [ (prop.key): prop.value])
filter(ReplaceTokens, tokens: [ ('project.' + prop.key): prop.value])
}
}
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter")
}

View File

@@ -0,0 +1 @@
custom.property=Custom Gradle Property

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>property-exp-default-config</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>property-exp-default-config</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../../parent-boot-1</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<custom.property>Custom Property Value</custom.property>
</properties>
</project>

View File

@@ -0,0 +1 @@
rootProject.name = 'property-exp-default'

View File

@@ -0,0 +1,13 @@
package com.baeldung.propertyexpansion;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootPropertyExpansionApp {
public static void main(String[] args) {
SpringApplication.run(SpringBootPropertyExpansionApp.class, args);
}
}

View File

@@ -0,0 +1,36 @@
package com.baeldung.propertyexpansion.components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
public class PropertyLoggerBean {
private static final Logger log = LoggerFactory.getLogger(PropertyLoggerBean.class);
@Value("${expanded.project.version}")
private String projectVersion;
@Value("${expanded.project.property}")
private String projectProperty;
@PostConstruct
public void printProperties() {
log.info("");
log.info("Properties logged from logger bean");
log.info("===========================================");
log.info("Project version : {}", projectVersion);
log.info("Project property : {}", projectProperty);
log.info("===========================================");
log.info("");
}
}

View File

@@ -0,0 +1,2 @@
expanded.project.version=@project.version@
expanded.project.property=@custom.property@

View File

@@ -0,0 +1,21 @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@########@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@@@@@:..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@#. @@@@@* *@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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
==========================================================
{expanded.project.version} is ${expanded.project.version}
{expanded.project.property} is ${expanded.project.property}
==========================================================

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

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