Commit 374c59c5 authored by João Lino's avatar João Lino

Initial commit.

parents
##LDE specific
.project
*.iml
*.idea
This diff is collapsed.
package com.joaolino.demo.spring.microservice.profile;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import java.util.ArrayList;
import java.util.List;
@ComponentScan(basePackages = "com.joaolino.demo.spring")
@SpringBootApplication(
exclude = {
MongoReactiveAutoConfiguration.class,
MongoDataAutoConfiguration.class,
MongoAutoConfiguration.class,
RabbitAutoConfiguration.class
})
@EnableDiscoveryClient
public class DemoSpringMicroserviceProfileApplication {
public static void main(final String[] args) {
SpringApplication.run(DemoSpringMicroserviceProfileApplication.class, args);
}
@Bean
public static OpenAPI customOpenAPI(@Value("${springdoc.external.server.uri}") final String uri) {
final List<Server> servers = new ArrayList<>();
servers.add(new Server().url(uri));
return new OpenAPI()
.info(
new Info()
.title("MVP Keystore")
.description(
"This is a Profile microservice. You can find out more about\n"
+ " the Profile microservice at [https://www.joaolino.com/gitlab/demo/demo-spring-microservice-profile/-/wikis/home](https://www.joaolino.com/gitlab/demo/demo-spring-microservice-profile/-/wikis/home).")
.termsOfService(
"https://www.joaolino.com/gitlab/demo/demo-spring-microservice-profile/-/wikis/home")
.contact(new Contact().email("joao.oliveira.lino@gmail.com"))
.license(new License().name("joaolino.com").url("https://joaolino.com/"))
.version("1.0.0"))
.externalDocs(
new ExternalDocumentation()
.description("Find out more about João Lino.")
.url("https://joaolino.com/"))
.servers(servers);
}
}
package com.joaolino.demo.spring.microservice.profile;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class DemoSpringMicroserviceProfileInitializer implements ApplicationRunner {
@Override
public void run(final ApplicationArguments args) {}
}
package com.joaolino.demo.spring.microservice.profile.data.model;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.*;
import java.util.Date;
/** This class stores audit information within entities */
@Data
@SuperBuilder
@NoArgsConstructor
public class AbstractAudit {
/** Version of the entry stored in the database */
@Version private Long version;
/** Date of creation of database entry */
@CreatedDate private Date createdAt;
/** Last date of modification in database */
@LastModifiedDate private Date modifiedAt;
/** Id of the user who created the entry */
@CreatedBy private String createdBy;
/** Id of the last user to modify the entry */
@LastModifiedBy private String lastModifiedBy;
/** FlowId which generated this entry */
private String flowId;
/** Session which generated this entry */
private String sessionId;
}
package com.joaolino.demo.spring.microservice.profile.data.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.Id;
import java.util.UUID;
/** This class stores identification information within entities */
@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class AbstractIdentification extends AbstractAudit {
/* A unique identifier of this model entity. */
@Id private final UUID id = null;
}
package com.joaolino.demo.spring.microservice.profile.data.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.data.mongodb.core.mapping.Document;
/** Represents a Profile. Contains all relevant information to define the profile of a person. */
@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Document
public class Profile extends AbstractIdentification {
/** The full name of the person. */
private final String fullName = null;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment