No he didn't. He honored the law. He didn't tell them to follow it. The rich, young ruler was already following the law. Jesus told him to follow him, not the law.
Matthew 5:19
" Whoever then annuls one of the least of these commandments, and teaches others to do the same, shall be called least in the kingdom of heaven; but whoeverkeeps and teaches them, he shall be called great in the kingdom of heaven."