Skip to content

Instantly share code, notes, and snippets.

View navichok26's full-sized avatar
💜

x5113nc3x navichok26

💜
View GitHub Profile
@navichok26
navichok26 / ChatController.java
Created May 31, 2020 17:51
WebSocket Controller
@Controller
public class ChatController {
@MessageMapping("/chat.sendMessage")
@SendTo("/topic/public")
public ChatMessage sendMessage(@Payload ChatMessage chatMessage) {
return chatMessage;
}
}
@navichok26
navichok26 / WebSocketConfig.java
Last active May 31, 2020 17:49
WebSocketConfig
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws").withSockJS();
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/app");
@navichok26
navichok26 / .gitignore
Created February 8, 2020 13:55
file .gitignote for intellijIDEA Spring boot progect
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
@navichok26
navichok26 / application.properties
Created February 8, 2020 12:09
Spring boot OAuth2 with google
security.oauth2.client.clientId=****
security.oauth2.client.clientSecret=****
security.oauth2.client.accessTokenUri=https://www.googleapis.com/oauth2/v4/token
security.oauth2.client.userAuthorizationUri=https://accounts.google.com/o/oauth2/v2/auth
security.oauth2.client.clientAuthenticationScheme=form
security.oauth2.client.scope=openid,email,profile
security.oauth2.resource.userInfoUri=https://www.googleapis.com/oauth2/v3/userinfo
security.oauth2.resource.preferTokenInfo=true
@navichok26
navichok26 / hibernate.cfg.xml
Created January 16, 2020 10:06
hibernate.cfg.xml for postgreSQL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:5432/test_db</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">1234</property>
@navichok26
navichok26 / application.properties
Created January 12, 2020 08:39
spring boot config for postgreSQL
spring.datasource.url=jdbc:postgresql://localhost:5432/springbootdb
spring.datasource.username=postgres
spring.datasource.password=1234
spring.jpa.hibernate.ddl-auto=create