Don’t use the database name at the end of the URI, mention username password and port, like this

if you’re using outside Mongodb container
spring.data.mongodb.uri=mongodb://admin:adminpassword@localhost:27017/
spring.data.mongodb.database=database_name

if you’re using inside MongoDB container
spring.data.mongodb.uri=mongodb://admin:adminpassword@mongodb:27017/

try this, it will help