Skip to content
Snippets Groups Projects
Commit 970e19a0 authored by Julian Horner's avatar Julian Horner
Browse files

Add basic application class and configuration to authentication service

parent ad864a3a
No related branches found
No related tags found
No related merge requests found
......@@ -3,43 +3,80 @@
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>de.rtuni.ms.ds</groupId>
<artifactId>dummy-service</artifactId>
<groupId>de.rtuni.ms.as</groupId>
<artifactId>authentication-service</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>authentication-service</name>
<description>Authentication service for microservice architecture</description>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<version>2.0.0.RELEASE</version>
</parent>
<dependencies>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</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</artifactId>
</dependency>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.1.RELEASE</version>
<configuration>
<mainClass>de.rtuni.ms.ds.Application</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>de.rtuni.ms.as.Application</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -3,21 +3,20 @@
* All Rights Reserved.
*/
package de.rtuni.ms.ds;
package de.rtuni.ms.as;
import java.util.Arrays;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
/**
* Authentication service for microservice architecture.
*
* @author Julian
*
*/
@SpringBootApplication
@EnableEurekaClient
public class Application {
//---------------------------------------------------------------------------------------------
......@@ -26,26 +25,7 @@ public class Application {
*
* @param args The arguments
*/
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
//---------------------------------------------------------------------------------------------
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
public static void main(final String[] args) { SpringApplication.run(Application.class, args); }
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
};
}
//---------------------------------------------------------------------------------------------
}
/*
* Copyright 2019 (C) by Julian Horner.
* All Rights Reserved.
*/
package de.rtuni.ms.ds;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Dummy controller.
*
* @author Julian
*
*/
@RestController
public class DummyController {
//---------------------------------------------------------------------------------------------
@RequestMapping("/")
public String index() {
return "Greetings from SB";
}
//---------------------------------------------------------------------------------------------
}
# Spring properties
spring:
application:
name: auth-service # Identify this application
# HTTP Server
server.port: 4444 # HTTP (Tomcat) port
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment