Reputation: 882
OK. I know this question have been asked many times here but I am sorry for asking again because none of them worked for me .What I am trying to do is @Autowired my JpaRepository in a Configurator extended class here is my code for doing this but I am getting null for connections .I have searched the internet I have found that this is out of scope for spring boot and I need to inject my webSocketConfigurator class into Spring boot ? correct me If I am wrong ? if yes how can I do this
@Configurable
public class webSocketConfigurator extends Configurator
{
@Autowired
ClientConnectionDao connections;
@Override
public void modifyHandshake(ServerEndpointConfig config, HandshakeRequest request, HandshakeResponse response)
{
super.modifyHandshake(config, request, response);
config.getUserProperties().put("ClientSession", request.getHttpSession());
}
}
public interface ClientConnectionDao extends JpaRepository<ClientConnection, Long> {
public ClientConnection findByport(String port);
public List<ClientConnection> findBymyuserName(String myUserName);
}
Upvotes: 0
Views: 250
Reputation: 21
The correct annotation is @Configuration
, not @Configurable
Upvotes: 2