求导函数可得,f′(x)=3x2+6ax+3(a+2)∵函数f(x)=x3+3ax2+3(a+2)x+1既有极大值又有极小值,∴f′(x)=3x2+6ax+3(a+2)=0有两个不等的实数根∴△=36a2-36(a+2)>0∴a2-a-2>0∴a<-1或a>2故选D