Professional Documents
Culture Documents
Project Answer
Project Answer
* to design api neede pojo class(Policy) ,one interface(Policyservice) in which curd method is
declaired,its imple (service)class(policyserviceimpl)
in which curd method impil adnd we inject policyservice repository I whichh extend curdrepository is
provided,one restcontroller(policycontroller)
-when we design api two thing to be remeber produce-creating api and consume --that api calling to
anguler
ex.for save
* we have one restcontroller policycontroller in which we use @autowire to inject a service (interface
pilicyservice is which abstract save method is present)
@Restcontroller
policycontroller{
@Autowired
@PostMapping("/save")
throws Exception {
return ResponseEntity.ok().body(createdPolicy);
where
*.ok().body()-Send response to the client with 200 http status code-200 satus code is success code
*policy-pojo class
* ResponseEntity -ResponseEntity represents the whole HTTP response: status code, headers, and body.
As a result, we can use it to fully configure
the HTTP response. If we want to use it, we have to return it from the endpoint; Spring takes care of the
res
-mention 2,3 field and getter settr and tostring method and parameter constructor
@Entity
@Table(name="policy")
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name="policynumber")
-goto controller
-run project
-check responce
#MysqL
spring.datasource.url=jdbc:mysql://localhost:3306/project?autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
@ResponseStatus(HttpStatus.NOT_FOUND)
super(message); //calling
- for getting id design method and then it wiil chck in db if not found it will throw
@autowired
PolicyRepository repo;
@Override
Policy policy=repo.findById(Id);//6
if(policy==null) {
return policy;
we send daata from postman request and check it is came in method or not by debug point
- design one class FactoryLifeGeneralnsurance in which one method which make validation and return
obj of iml class
-if useer put genralinsurace then it will return obj of genralinsu imp class
*INterface
*factorymethod
if (type == null) {
return null;
} else if (type.equalsIgnoreCase("general")) {
}}
*impl class
@Override
if we got error like saving data and user data is saved but policy data is not saved to handel this
setuatiion we use
@EnableTransactionManagment in main service method
in properties file and in each method* private static final Logger logger =
LoggerFactory.getLogger(InsuranceRestApplication.class);
logging.level.root=WARN
loging,level.org.springframwork.web=DEBUG
logging.level.org.hibernate.ddl.auto=ERROR
logging.file.name=F:/application.log
server.error.include-stacktrace=never
@Repository
*12 archtecture
4 layer
I have not worked on deployment, diffrant team is there and managment level people is handling this
things
2 Development servrer -ip url live deployent 192.168.12.2 primary developer team will usee this
4 user acceptance testing-client approved the projecct then deploy on this server
*16 TECHNOLOGY
programing laguag-java
front end-anguler
webservice-Restfull
framework-springboot hibernate
databse-mysql
server-apacheTomcat
version control-git
sdlc-Agile
Testing-unit tetsing
Editor-vs code
Design pattern-factory
yes
in this what we are dilivering to client and by seeing he can understand what actuaal flow is
in summery we have log in mangment(user should b able to log in) and policy managment(user shoould
be able to add /upadate\delete)
we have to mention in format issue like serch button is not working and give to client
sometimes bugs like null pointer (sometimes ref varible is acccesed and not pioninting tpo obj)
****JIRA***
issue---story or task
-server.port=8080
-server.context-path=/anyHost
* validation for spring security
-we have enable spring security we have user managment service(http) is there it takes(filter) username
and passward and check in db present or not
-if username is present we have checking encrypted pass with decrypting pass checking everything is
fine or not .if fine we creating jwt token and
we r sending back to user(filter) token consist of algorithm ,username, expiry time , authentication
pssing to user and whenever trying to hit another
api using that token .we checking authorization, header present or not in postman .if present we getting
that token converting into userdatails retriving
first u got authorization then it will create session context and then in session context authenticcate
username and passsword .
@Repository
List<Student> findAllByOrderByNameAsc();
3: Spring Web
*INTRODUCTION
-It is web based application that keep track of policy details of each customer,
-there are diff pay modes like montholy,querterly,yearly,payment can be online or check
-it has facility to provide nomeenee details ,able to veiw transaction,claim details ,premium details .
-bug fixing
- the technology we have used like core java,restfull web service,spring boot
hibernate,mysql,tomcat,git,maven,angular
if you work with Web Applications, however, they don't have main method. The artifacts are Web
Archives (have extension .WAR). Instead of "main" method you're supposed to create a
SpringBootServletInitializer that will serve as an entry point of your WAR.
** The HTTP 409 status code (Conflict) indicates that the request could not be processed because of
conflict in the request,
The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates
that the server encountered an unexpected condition that prevented it from fulfilling the request
return Responceentity.ok.body(hhtp.status)
****ROLE
i have worked on 3 layers. But specifically i've worked on Service layer where i was delecating the
controller requests to DAO layer. Also there I write business logic like if I want to perform any operation
before sending out a call to the DAO.
**Immutable class
final calss A{
this.name =name;
return name;
}}
****************************************
fcci in group,