Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions TestPlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,3 +429,11 @@ Exception in thread "main" java.lang.IllegalStateException
CustomEnv: This env is for test plan.
SystemPath: <value of PATH >
```

## Runtime classpath entry
1. Open `27.runtimeClassEntry` in vscode.
2. Press <kbd>F5</kbd> to start.
3. Verify the output in Debug Console should be as following:
```
Tomcat started on port(s): 8080 (http)
```
63 changes: 63 additions & 0 deletions testprojects/27.runtimeClassEntry/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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>

<groupId>com.github.kdvolder</groupId>
<artifactId>hello-world-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.github.kdvolder.helloworldservice;

public class Constants {
public static final String GREETER_ID = "greeets";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.github.kdvolder.helloworldservice;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@SpringBootApplication
@RestController
@EnableScheduling
public class DemoApplication {

public static class Bar {
}

public static class Foo {
}

@Autowired(required=false) void foo(@Qualifier("foobar")Foo foo) {
System.out.println("a Foo got injected");
}

@Autowired(required=false) void bar(@Qualifier("foobar")Bar bar) {
System.out.println("a Bar got injected");
}

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

@GetMapping(value="/")
public String mainpage() {
return "Hello "+System.getProperty("greeting");
}


@GetMapping(value = "/hello/{name}")
public String getMethodName(@PathVariable String name) {
return "Hello "+name;
}


@Bean Foo foobar() {
return new Foo();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.kdvolder.helloworldservice;

import org.springframework.stereotype.Component;


@Component
public class Greeter {

String greeting(String name) {
return "Hello "+name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.github.kdvolder.helloworldservice;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;

@ConfigurationProperties("my")
public class MyProperties {

private String hello;

/**
* @return the hello
*/
@DeprecatedConfigurationProperty(replacement="new.my.hello")
public String getHello() {
return hello;
}

/**
* @param hello the hello to set
*/
public void setHello(String hello) {
this.hello = hello;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
my.hello=Yadaya
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
my:
other: stuff
hello: blah
new:
my:
other: stuff
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.kdvolder.helloworldservice;

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
public class DemoApplicationTests {

@Test
public void contextLoads() {
}

}