Created
September 25, 2016 05:12
-
-
Save kaunjovi/b336886f319533f443cfbac1ec081abe to your computer and use it in GitHub Desktop.
Spring Boot | Getting started | 0010
This file contains hidden or 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
package fun.and.games; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.context.ApplicationContext; | |
@SpringBootApplication | |
public class MyApplication { | |
final static Logger logger = LoggerFactory.getLogger(MyApplication.class); | |
public static void main(String[] args) { | |
logger.debug("Hello world from Spring Boot."); | |
// This will start up the class as a Spring application. | |
// Also you will have the beans up in the application context should you | |
// need them. | |
ApplicationContext appContext = SpringApplication.run(MyApplication.class, args); | |
// logger.debug("We have loaded {} beans up.", | |
// appContext.getBeanDefinitionCount()); | |
} | |
} |
This file contains hidden or 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
<?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>fun.and.games</groupId> | |
<artifactId>learnspringboot</artifactId> | |
<version>0.1.0</version> | |
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>1.4.1.RELEASE</version> | |
</parent> | |
<dependencies> | |
<!-- Put some logs, for when there will be an issue. There will be one. --> | |
<dependency> | |
<groupId>ch.qos.logback</groupId> | |
<artifactId>logback-classic</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<!-- mvn -e clean install exec:java --> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>exec-maven-plugin</artifactId> | |
<configuration> | |
<mainClass>fun.and.games.MyApplication</mainClass> | |
</configuration> | |
</plugin> | |
<!-- Configure the project to use java 8 version. --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<configuration> | |
<source>1.8</source> | |
<target>1.8</target> | |
<!-- Disable annotation processing for ourselves. --> | |
<compilerArgument>-proc:none</compilerArgument> | |
</configuration> | |
</plugin> | |
<!-- mvn -e clean install spring-boot:run --> | |
<plugin> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-maven-plugin</artifactId> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment