Spring-Boot, Can't save unicode string in MySql using spring-data JPA

前端 未结 6 1416
一整个雨季
一整个雨季 2020-12-20 18:04

I have my application.properties set up like this :

spring.datasource.username = root
spring.datasource.password = root
spring.datasource.url =         


        
6条回答
  •  再見小時候
    2020-12-20 18:20

    Non of the answer worked for me … except the url encoding part.

    The solution in my case is twofold:

    1- Add encoding in the URL of Database config bean:

    
    

    2- Add this configuration to your dispatcher config file:

    
        encoding-filter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
        
            forceEncoding
            true
        
    
    
    
        encoding-filter
        /*
        REQUEST
        FORWARD
    
    

    Otherwise, other configurations don't take effect.

提交回复
热议问题