forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added springbootnonwebapp project code
- Loading branch information
hemant
committed
May 30, 2018
1 parent
a0c907b
commit f1d4024
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
spring-boot/src/main/java/com/baeldung/springbootnonwebapp/HelloController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.baeldung.springbootnonwebapp; | ||
|
||
import java.time.LocalDate; | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* Controller exposing rest web services | ||
* @author hemant | ||
* | ||
*/ | ||
@RestController | ||
public class HelloController { | ||
|
||
@RequestMapping("/") | ||
public LocalDate getMinLocalDate() { | ||
return LocalDate.MIN; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
spring-boot/src/main/java/com/baeldung/springbootnonwebapp/Runner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.baeldung.springbootnonwebapp; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class Runner implements CommandLineRunner { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(Runner.class); | ||
|
||
/** | ||
* This method will be executed after the application context is loaded and | ||
* right before the Spring Application main method is completed. | ||
*/ | ||
@Override | ||
public void run(String... args) throws Exception { | ||
LOG.info("START : command line runner"); | ||
LOG.info("EXECUTING : command line runner"); | ||
LOG.info("END : command line runner"); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...g-boot/src/main/java/com/baeldung/springbootnonwebapp/SpringBootNonWebappApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.baeldung.springbootnonwebapp; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class SpringBootNonWebappApplication { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(SpringBootNonWebappApplication.class); | ||
|
||
public static void main(String[] args) { | ||
LOG.info("STARTING THE APPLICATION"); | ||
SpringApplication app = new SpringApplication(SpringBootNonWebappApplication.class); | ||
// This line of code, disables the web app setting | ||
app.setWebEnvironment(false); | ||
app.run(args); | ||
LOG.info("APPLICATION STARTED"); | ||
} | ||
} |