I was wondering if it was possible to get mob spawners in vanilla minecraft in creative mode. I'm playing on version 1.12.2.
Try using the command
/give @s mob_spawner. This will only work if your world has cheats enabled; there's no other way to get a mob spawner in your inventory. (Using a tool enchanted with silk touch doesn't work, for example.)
The mob spawner will have a pig in it by default, but you can right click the block with a spawn egg (which you can find in the "Miscellaneous" section of the creative inventory) to change the mob that spawns in it.
Yes but only with cheats
If you use the cheat
/give (playername) (itemid) (amount)
You can then use https://minecraft.gamepedia.com/ to find the item ID of the item you want. (sorry if this site goes down I don't know of any other way to find the item ID without going into the code)
For spawners the code is "52:" then a number defining what type of mob the spawner spawns.
Item IDs for all spawners
52:50 = Creeper 52:51 = Skeleton 52:52 = Spider 52:53 = Giant 52:54 = Zombie 52:55 = Slime 52:56 = Ghast 52:57 = PigZombie 52:58 = Enderman 52:59 = CaveSpider 52:60 = Silverfish 52:61 = Blaze 52:62 = Lavaslime (magma cube) 52:63 = EnderDragon 52:64 = WitherBoss 52:65 = Bat 52:66 = Witch 52:90 = Pig 52:91 = Sheep 52:92 = Cow 52:93 = Chicken 52:94 = Squid 52:95 = Wolf 52:96 = MushroomCow 52:97 = SnowMan 52:98 = Ozelot 52:99 = VillagerGolem 52:100 = Horse