Spring parsing xml understanding

Sprign parses xml configuration using dom4j Step 1: get Document public class DocumentHelper{ //Declare map storage node private Map<String, Document> docs = new HashMap<String, Document>(); public Document getDocument(String filePath) { //Get the document according to the path first with HashMap Docu ...

Posted on Sun, 08 Dec 2019 13:38:49 -0500 by darence

Spring IOC container assembly Bean based on annotation configuration

bean instantiation 1. Import jar package (necessary) 2. Instantiate bean applicationContext.xml(xml writing method) <bean id="userDao" class="com.igeekhome.dao.impl.UserDao"></bean> How to write notes First, enable annotation scanning in applicationContext.xml (and introduce context namespace) <?xml version="1.0" encoding="UT ...

Posted on Sun, 08 Dec 2019 12:12:41 -0500 by cobalt30

13Spring - Spring transfer Demo (learn about transactions and AOP)

Spring's transfer case 1) code preparation 1) create business layer public interface AccountService { public void transfer(String from, String to, Double money); } ----------------------------------------------------------------------------------- public class AccountServiceImpl implements AccountService { // Busi ...

Posted on Sun, 08 Dec 2019 09:54:52 -0500 by dr_overload

spring boot learning: spring application and custom banner

SpringApplication In general, we use spring application to start the spring boot application. as @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } There are two other ways: Custom SpringApplication: SpringApplication app = n ...

Posted on Sun, 08 Dec 2019 07:35:35 -0500 by busterbry

Using aop to encrypt and decrypt http interface

background Recently, I am writing a small program interface. Because of its high security, I need to encrypt the request parameters and response. If we encrypt and decrypt every method, the code will be too tedious and the workload will increase. Therefore, we will carry out unified encryption and decryption processing. A more traditional way i ...

Posted on Sun, 08 Dec 2019 07:03:59 -0500 by hebisr

Eureka Registry - service discovery

Eureka registry / service discovery framework Eureka is a service discovery framework developed by Netflix. It is a REST based service. It is mainly used to locate the middle tier services running in the AWS domain to achieve the purpose of load balancing and service failover in the middle tier. Spring cloud integrates it into its subproject, ...

Posted on Sun, 08 Dec 2019 04:39:48 -0500 by sirish

Solve the inconsistency of session ID in cross domain access of ajax

According to the protection rules of the browser, the sessionId created by us will not be saved by the browser when cross domain access occurs. In other words, the server will think that it is a new person, not the same person, for each request. In order to solve this problem, here's how to There are ways to solve this cross domain approach.   ...

Posted on Sun, 08 Dec 2019 03:07:35 -0500 by importune

SpringBoot Unified Exception Handling

Sample code in https://github.com/laolunsi/spring-boot-examples 1. Global Unified Exception Handling Configuration Let's start with an interface: @RestController @RequestMapping(value = "") public class IndexAction { @GetMapping(value = "add") public Integer add(Integer a, Integer b) { return a+b; } } Think: What happens i ...

Posted on Sat, 07 Dec 2019 23:19:59 -0500 by sdaniels

Using JPA in SpringBoot

In the last article, we used the JdbcTemplate to access the database. After all, we used the native SQL form. I'm sure that lazy people like me won't consider it.. This record uses JPA to greatly reduce our code volume First, prepare the SQL file DROP TABLE IF EXISTS users; CREATE TABLE users ( id INT ( 11 ) PRIMARY KEY AUTO_INCR ...

Posted on Sat, 07 Dec 2019 19:49:01 -0500 by alwoodman

Using Controller to extract data in elastic search (simple query)

Spring boot's support for elastic search can provide data query directly called in the Controller layer, which can be implemented without any query statement written by you. maven relies on: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter ...

Posted on Sat, 07 Dec 2019 18:32:44 -0500 by corruption