行。我知道这个问题已在这里被多次询问但我很抱歉再次提问,因为它们都没有为我工作。我想要做的是@Autowired我的JpaRepository在Configurator扩展类这里是我做这个的代码但是我我的连接是空的。我在互联网上搜索过我发现这超出了弹簧启动的范围,我需要将我的webSocketConfigurator类注入Spring启动?纠正我如果我错了?如果是的话我该怎么做呢
@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);
}
答案 0 :(得分:2)
正确的注释是@Configuration
,而不是@Configurable