Yes.
Enemies can spawn anywhere inside settlements so it doesn't do you any good to build walls or any other obstacle to keep them out.
http://www.gamesas.com/topic/1578214-11-machine-gun-and-5-laser-turrets/ I started about this exact subject at this exact location.
I always fast travel to Concord and walk to Red Rocket because it seems to trigger attacks sometimes when I do that and I like to watch my fortifications in action.
Edit: I've also noticed that if I'm wearing Power Armor and I'm at maximum weight capacity but still able to run and I get out of the armor and am now weighted down so I can't run, then go to a workbench to break down weapons, that will trigger attacks.
You can still hear what's going on in the background while working at a bench and I'd say about 90% of the time when I go to a bench while I'm carrying too much I'll get attacked. But it only seems to happen if I was in Power Armor and step out, not if I take inventory from a companion and then become over-weighted.
I like to set up a lot of defenses and watch the battles.