docker  run -d  --name  redis-container -p  6379 :6379 redis:latest
FROM  openjdk:17
RUN mkdir  -p  /data/etax/ms-app
WORKDIR /data/etax/ms-appEXPOSE 10133 
COPY ./target/fe-msv-ntp-ms3-1.0.0-SNAPSHOT.jar /data/etax/ms-app/app.jar
ENTRYPOINT [ "java" ,"-jar" ,"app.jar" ] 
docker  build -t  test-docker:v3 ./
docker  run -d  --name  test-docker-app -p  10133 :10133 test-docker:v3
import  org. springframework. boot.  SpringApplication ; 
import  org. springframework. boot. autoconfigure.  SpringBootApplication ; @SpringBootApplication 
public  class  AppApplication  { public  static  void  main ( String [ ]  args)  { SpringApplication . run ( AppApplication . class ,  args) ; } 
} <?xml version="1.0" encoding="UTF-8"?> 
< projectxmlns = " http://maven.apache.org/POM/4.0.0" xmlns: xsi= " http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation= " http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > < parent> < groupId> </ groupId> < artifactId> </ artifactId> < version> </ version> </ parent> < modelVersion> </ modelVersion> < artifactId> </ artifactId> < version> </ version> < properties> < java.version> </ java.version> < maven.compiler.source> </ maven.compiler.source> < maven.compiler.target> </ maven.compiler.target> < start-class> </ start-class> < maven-compiler-plugin.version> </ maven-compiler-plugin.version> < maven-spring-boot-plugin.version> </ maven-spring-boot-plugin.version> < maven-surefire-plugin.version> </ maven-surefire-plugin.version> < maven-compiler-plugin.version> </ maven-compiler-plugin.version> </ properties> < dependencies> < dependency> < groupId> </ groupId> < artifactId> </ artifactId> </ dependency> < dependency> < groupId> </ groupId> < artifactId> </ artifactId> </ dependency> < dependency> < groupId> </ groupId> < artifactId> </ artifactId> </ dependency> < dependency> < groupId> </ groupId> < artifactId> </ artifactId> </ dependency> </ dependencies> < build> < plugins> < plugin> < groupId> </ groupId> < artifactId> </ artifactId> < version> </ version> </ plugin> < plugin> < groupId> </ groupId> < artifactId> </ artifactId> < version> </ version> < configuration> < mainClass> </ mainClass> </ configuration> < executions> < execution> < goals> < goal> </ goal> </ goals> </ execution> </ executions> </ plugin> </ plugins> < resources> < resource> < directory> </ directory> < includes> < include> </ include> </ includes> < filtering> </ filtering> </ resource> </ resources> </ build> </ project> spring : application : name :  fe- msv- ntp- ms3- app
redis : host :  10.130.6.126port :  6379 
server : port :  10133 
import  org. springframework. beans. factory. annotation.  Value ; 
import  org. springframework. context. annotation.  Bean ; 
import  org. springframework. context. annotation.  Configuration ; 
import  org. springframework. data. redis. connection.  RedisConnectionFactory ; 
import  org. springframework. data. redis. connection. lettuce.  LettuceConnectionFactory ; 
import  org. springframework. data. redis. core.  RedisTemplate ; @Configuration 
public  class  RedisConfig  { @Value ( "${spring.redis.host}" ) String  host; @Value ( "${spring.redis.port}" ) String  port; @Bean public  RedisConnectionFactory  redisConnectionFactory ( )  { System . out. println ( "创建 Redis 连接工厂" ) ; LettuceConnectionFactory  factory =  new  LettuceConnectionFactory ( ) ; factory. setHostName ( host) ; factory. setPort ( Integer . parseInt ( port) ) ; return  factory; } @Bean public  RedisTemplate < String ,  Object > redisTemplate ( RedisConnectionFactory  connectionFactory)  { RedisTemplate < String ,  Object > =  new  RedisTemplate < > ( ) ; template. setConnectionFactory ( connectionFactory) ; return  template; } } import  org. springframework. beans. factory. annotation.  Autowired ; 
import  org. springframework. data. redis. core.  RedisTemplate ; 
import  org. springframework. web. bind. annotation.  GetMapping ; 
import  org. springframework. web. bind. annotation.  RequestMapping ; 
import  org. springframework. web. bind. annotation.  RestController ; @RestController 
@RequestMapping ( "/test" ) 
public  class  TestController  { @Autowired RedisTemplate < String ,  Object > ; @GetMapping ( "/success" ) public  String  success ( )  { return  "success" ; } @GetMapping ( "/setValue" ) public  void  setValue ( String  key,  String  value)  { redisTemplate. opsForValue ( ) . set ( key,  value) ; System . out. println ( "key="  +  key +  "value="  +  value) ; } @GetMapping ( "/getValue" ) public  String  getValue ( String  key)  { return  ( String )  redisTemplate. opsForValue ( ) . get ( key) ; } }