made incomplete misc changes
This commit is contained in:
parent
ba12033e90
commit
8259f6cc49
4 changed files with 51 additions and 6 deletions
|
@ -0,0 +1,14 @@
|
||||||
|
package me.imsonmia.epqapi.config;
|
||||||
|
|
||||||
|
import org.hibernate.dialect.MariaDBDialect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MySQLCustomDialect
|
||||||
|
*/
|
||||||
|
public class MySQLCustomDialect extends MariaDBDialect {
|
||||||
|
// https://stackoverflow.com/questions/42430786/how-to-set-collation-for-table-attribute-as-utf8-bin-in-either-annotation-or-app#54993738
|
||||||
|
@Override
|
||||||
|
public String getTableTypeString() {
|
||||||
|
return " ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package me.imsonmia.epqapi.config;
|
package me.imsonmia.epqapi.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
||||||
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
||||||
|
@ -10,12 +11,12 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo
|
||||||
@EnableWebSocketMessageBroker
|
@EnableWebSocketMessageBroker
|
||||||
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageBroker(MessageBrokerRegistry registry) {
|
public void configureMessageBroker(@NonNull MessageBrokerRegistry registry) {
|
||||||
registry.enableSimpleBroker("/sub");
|
registry.enableSimpleBroker("/sub");
|
||||||
registry.setApplicationDestinationPrefixes("/app");
|
registry.setApplicationDestinationPrefixes("/app");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
public void registerStompEndpoints(@NonNull StompEndpointRegistry registry) {
|
||||||
registry.addEndpoint("/ws").setAllowedOrigins("*");
|
registry.addEndpoint("/ws").setAllowedOrigins("*");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package me.imsonmia.epqapi.view;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
|
import me.imsonmia.epqapi.model.Message;
|
||||||
|
|
||||||
|
public class MessageSpecification implements Specification {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder builder) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,15 @@
|
||||||
spring.datasource.url=jdbc:mariadb://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8
|
spring.datasource.url=jdbc:mariadb://127.0.0.1:3306/epqchat
|
||||||
spring.datasource.username=dbuser
|
spring.datasource.username=epqchatuser
|
||||||
spring.datasource.password=dbpasswd
|
spring.datasource.password=epqlevel3artifact
|
||||||
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||||
|
|
||||||
|
# Use custom database handler to ensure that the API and database table collations
|
||||||
|
# run in UTF-8-MB4 mode. This should get rid of all the encoding issues previously present.
|
||||||
|
spring.jpa.properties.hibernate.dialect=me.imsonmia.epqapi.config.MySQLCustomDialect
|
||||||
spring.jpa.show-sql: true
|
spring.jpa.show-sql: true
|
||||||
spring.jpa.hibernate.ddl-auto=create-drop
|
# https://stackoverflow.com/questions/42135114/how-does-spring-jpa-hibernate-ddl-auto-property-exactly-work-in-spring
|
||||||
|
# Summarisation
|
||||||
|
# create-drop for testing
|
||||||
|
# validate for semi-production
|
||||||
|
# none for serious prod scenarios
|
||||||
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue