Posts

Showing posts from May, 2019

database logic

brief : ALTER TABLE A       ADD CONSTRAINT id       PRIMARY KEY (id) ALTER TABLE B ADD COLUMN a_id VARCHAR //add fkey  in B as additional cols ALTER TABLE B ADD COLUMN a_id int //now create the fkey ref to agent table on address table alter table B ADD Foreign key(a_id) references A(id); // To obtain the generated constraint name of a table SHOW CREATE TABLE B; ALTER TABLE B DROP FOREIGN KEY b _ibfk_1; //to disable fkey checks. SET foreign_key_checks = 0/1;

Angular 2 & 2+

how to fixe cors problen in angular 6. -------------------------------------------- e.g. -@CrossOrigin(origins = "http://localhost:4200/") -at @configuration class  @Bean     public CorsFilter corsFilter() {         UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();         CorsConfiguration config = new CorsConfiguration();         config.setAllowCredentials(true);         config.addAllowedOrigin("*");         config.addAllowedHeader("*");         config.addAllowedMethod("OPTIONS");         config.addAllowedMethod("GET");         config.addAllowedMethod("POST");         config.addAllowedMethod("PUT");         config.addAllowedMethod("DELETE");         source.registerCorsConfiguration("/**", config);         return new CorsFilter(source);     } //Api call-> http api call 1.first HttpClient i

Spring-boot

advantage : 1. production ready application  2. complex configuartion is reduced  3. pom.xml -all dependency define via ths file . 4. used for standalone and web apps . 5. used for microservices -*** 6. @EnableAutoConfiguration  automatically configures the Spring application based on its included jar files  note:   6.1-  Auto-configuration is usually applied based on the classpath and the defined beans      6.2- @EnableAutoConfiguration has a exclude attribute to disable an auto-configuration explicitly otherwise we can simply exclude it from the pom.xml, for example if we donot want Spring to configure the tomcat then exclude spring-bootstarter-tomcat from spring-boot-starter-web.    eg. like as follwing : <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.apache.tomcat</groupId> &l