Prerequisites-
• Java 7 or Above
• Maven 3.2 or above
• Eclipse Oxygen or any after Eclipse Neon
• Consul (project specific)
• Git (project specific)
• Jenkins (project specific)
Microservices
• Microservice Architecture is a special design pattern of Service-oriented
Architecture. In this type of service architecture, all the processes will
communicate with each other with the smallest granularity to implement a big
system or service.
• Independent − Each microservice should be independently deployable.
• Coupling − All microservices should be loosely coupled with one another such
that changes in one will not affect the other.
• Business Goal − Each service unit of the entire application should be the
smallest and capable of delivering one specific business goal.
Example -
Getting Started-
• https://start.spring.io/
Annotations-
• @EnableAutoConfiguration - configures your application based on the dependencies you have added to
the project
• @SpringBootApplication - The entry point of the spring boot application is the class
contains this annotation and the main method.
• @ComponentScan - automatically scans all the components included in the project
• @SpringBootApplication - If you added this annotation to the class, you do not need to add
the @EnableAutoConfiguration, @ComponentScan and @SpringBootConfigurationannotation.
The @SpringBootApplication annotation includes all other annotations.
• @Configuration- declares one or more @Bean methods and may be
processed by the Spring container to generate bean definitions and
service requests for those beans at runtime.
• @EnableJpaRepositories(basePackages={“”}) - Will scan the package
of the annotated configuration class for Spring Data repositories by
default
• @EnableTransactionManagement- Enables Spring's annotation-
driven transaction management capability
• @EntityScan - Set the packages scanned for JPA entities.
• @Component – Indicates that an annotated class is a "component".
Such classes are considered as candidates for auto-detection when
using annotation-based configuration and classpath scanning.
• @Autowired – Creating bean dependency
• @RestController - so that each method marshalls the returned
resource right to the HTTP response.
• @RequestMapping – path mapping for the request
• @ResponseBody – attaching response to the web
• @Entity
• @Table
• @Id
• @Column
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
GIT
• Git clone repository location
• Git pull
• Git commit –m “commit message”
• Git push
• Git checkout
Jenkins –
http://jenkinsscmidc01-prod.idc1.level3.com:8080/
Mesos –
http://mesosidc01-test.idc1.level3.com:8080/
Project Specific cloud-
• Consul - cloud config
• Configuring consul for your project-
• spring.cloud.consul.config.watch.enabled=false
• spring.cloud.consul.discovery.prefer-ip-address=false
• spring.cloud.consul.discovery.queryPassing=true
Set up –
http://amofappdlp12.twtelecom.com/voice/developer-workstation-set
up.html
http://consulidc01-env1.idc1.level3.com:8500/ui/
Assignment .. ?!
Create a web application which -
• saves Employee information given in a UI form to DB .
• User enters EmployeeID and click submit to display complete
Employee information on the UI